I am just working on Bootstrap datetimepicker, and I am done that. A small problem is there, I tried to change the selected date format and failed. How can I fix this?
This is my code:
$('.datepicker').datetimepicker({
dateFormat: "dd-mm-yy",
timeFormat: "HH:mm:ss"
});
This is my jsfiddle link http://jsfiddle.net/vishnur15/8tsCt/2/
In order to set the date format, we only need to add format of one argument and then we will add our required format, which is shown in the following example: Example 1: In this example, we are going to use dd-mm-yyyy format.
An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field.
Bootstrap-datepicker provides a flexible datepicker widget in the Bootstrap style. Versions are incremented according to semver.
check this jsfiddle
http://jsfiddle.net/8tsCt/4/ --not working due to reference link broken
latest version as per 2017
http://jsfiddle.net/8tsCt/166/
format must be
$('.datepicker').datetimepicker({
format: 'DD-MM-YYYY HH:mm:ss'
});
Please use data-date-format="DD-MM-YYYY HH:mm:ss"
inside the input tag.
<input data-date-format="DD-MM-YYYY HH:mm:ss" type="text" />
See this. https://jsfiddle.net/h0jk6oq4/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With