How to set default time on Bootstrap timepicker
51,016
Solution 1
You can set the default time via JavaScript :
$('mySelector').timepicker({defaultTime: '10:45 PM'});
Or directly via the value attribute of your timepicker :
<div class="bootstrap-timepicker">
<input id="timepicker" type="text" value="10:45 AM"/>
</div>
$('.myClass').timepicker({defaultTime: 'value'});
EDIT : was for the default timepicker of boostrap, my bad.
For your specific timepicker, it seems possible to set the datetime like this :
var picker = $('#datetimepicker').data('datetimepicker');
picker.setDate(myDate);
Solution 2
From the documentation page..
setTime Set the time manually
$('#timepicker').timepicker('setTime', '12:45 AM');
Author by
iamspauljamez
Self-centered bastard developer based in the country called 'Philippines'. :)
Updated on February 08, 2021Comments
-
iamspauljamez about 3 years
How can I set default time instead of current time for this datetimepicker http://tarruda.github.io/bootstrap-datetimepicker/ ?