I am using the jquery datetimepicker and set it up as follows
$('.fddatetimepicker').datetimepicker({
dateFormat: 'dd/mm/yy'
});
No date is set by default. When I increment either of the hour or minute sliders for the first time by one place, I get the correct time but the date is set to 31/12/1899 in the input textbox. When i move the slider again it changes to the current date which is what I want.
Does anyone know why the initial increment of the slider causes the date to be 31/12/1899?
I also see this behaviour if i click anywhere on the slider for the first time and then the correct date is displayed when I click on the sliders any further times.
I am using the jquery datetimepicker and set it up as follows
$('.fddatetimepicker').datetimepicker({
dateFormat: 'dd/mm/yy'
});
No date is set by default. When I increment either of the hour or minute sliders for the first time by one place, I get the correct time but the date is set to 31/12/1899 in the input textbox. When i move the slider again it changes to the current date which is what I want.
Does anyone know why the initial increment of the slider causes the date to be 31/12/1899?
I also see this behaviour if i click anywhere on the slider for the first time and then the correct date is displayed when I click on the sliders any further times.
Share Improve this question asked May 7, 2015 at 14:49 Macca18Macca18 812 silver badges6 bronze badges 2- Might be this issue: stackoverflow./questions/21964112/… – Cody Commented May 7, 2015 at 14:55
- Have used some jQuery to ensure any 1899 date is replaced with current date – Macca18 Commented May 11, 2015 at 14:08
3 Answers
Reset to default 4just change the format of datetimepicker by using the below code. It will work like a charm. I had the same issue and I fixed using that approach below code.
$('.datetimepicker').datetimepicker({
format: "dd-mm-yyyy hh:ii:00P",
autoclose: true
});
You can use the "startDate: new Date" property to start on the current date.
Example:
$('.fddatetimepicker').datetimepicker({
dateFormat: 'dd/mm/yy',
startDate: new Date
});
More options and properties in: http://xdsoft/jqplugins/datetimepicker/
Try using format: 'mm/dd/yyyy hh:ii:ss P' The trick is to make sure your date format is the same as what the back-end returns.