Set default time in bootstrap-datetimepicker

前端 未结 13 2265
后悔当初
后悔当初 2020-12-03 10:21

I want to set default time in this datetimepicker as 00:01 for the current date. Anyone tried that before? Having a tough time with it. It Seems simple.

13条回答
  •  旧时难觅i
    2020-12-03 10:42

    This works for me after a long hours of search , This solution is for Bootstrap datetimepicker version 4. when you have to set the default date in input field.

    HTML

    "input type='text' class="form-control" id='datetimepicker5' placeholder="Select to date" value=''// $myDate is having value '2016-02-23' "
    

    Note- If You are coding in php then you can set the value of the input datefield using php, but datetimepicker sets it back to current date when you apply datetimepicker() function to it. So in order to prevent it, use the given JS code

    JAVASCRIPT

    
    

提交回复
热议问题