html - Eonasdan Bootstrap datetimepicker format -
how set format in bootstrap 3 datetimepicker. want format "dd/mm/yyyy hh:mm" , dont want "am" , "pm". in language can use here. following fiddle how can this?
http://jsfiddle.net/eonasdan/0ltv25o8/
$('#datetimepicker1').datetimepicker({ format : "dd/mm/yyyy hh:mm", });
<!-- padding jsfiddle --> <div class="row"> <div class="col-md-12"> <div class="form-group"> <div class="input-group date" id="datetimepicker1"> <input type="text" class="form-control" /> <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span> </div> </div> </div> </div>
$('#datetimepicker1').datetimepicker({format : "dd/mm/yyyy hh:mm"}); $('#datetimepicker2').datetimepicker({format : "dd/mm/yyyy hh:mm"});
<head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/js/bootstrap-datetimepicker.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.7.14/css/bootstrap-datetimepicker.min.css" rel="stylesheet"/> </head> <br/> <!-- padding jsfiddle --> <div class="row"> <div class="col-md-12"> <h6>datetimepicker1</h6> <div class="form-group"> <div class="input-group date" id="datetimepicker1"> <input type="text" class="form-control" /> <span class="input-group-addon"><span class="glyphicon-calendar glyphicon"></span></span> </div> </div> <h6>datetimepicker2</h6> <input type="text" class="form-control" id="datetimepicker2" /> </div> </div>
i'm not sure why yours isn't working, using dd/mm/yyyy hh:mm
gives output we/04/yyyy 08:43
. if want output example 01/03/2015 12:01
need set format : "dd/mm/yyyy hh:mm"
. more information on format options take @ momentjs documentation.
see updated jsfiddle
you need make sure include of necessary css , js files datetimepicker needs work. need momentjs , jquery load first. see code snippet.
Comments
Post a Comment