0

I have bootstrap datetimepicker in my form. How to initialize it with my own time. I tried several options none of these are working. And also I want to disable past dates on date picker.

$('#timePicker').datetimepicker({
    useCurrent: false,
    format: "HH:mm",
    pickDate: false,
    defaultTime: '01:00 PM'
});

EDIT:

I tried the following, but it is initializing the picker as 03:00 AM and load the input field with this value. I just need the picker to be initialized with 01:00 PM, but no value is expected in the input field until user select the time from the picker.

$('#timePicker').datetimepicker({
    useCurrent: false,
    format: "hh:mm A",
    defaultDate: '2000-01-01 01:00 PM'
});
user1614862
  • 3,701
  • 7
  • 29
  • 46
  • Might be a duplicate of [set default time in bootstrap-datetimepicker](http://stackoverflow.com/questions/18005455/set-default-time-in-bootstrap-datetimepicker). Please use correct JS syntax for your selectors. – Matt Jul 11 '16 at 08:17
  • That is not working for me. I just want to initialize only time picker and when user clicks on the input box I want the picker to be opened with 01:00 PM, upon selecting desired time by the user I want to populate the input box with the selected value. When I use defaultDate attribute the input box is getting loaded with 03:00 AM on load of the page itself where it is expected to be empty in the beginning. I have modified the selector. It was typo mistake. – user1614862 Jul 11 '16 at 08:23

0 Answers0