Reputation: 4596
I found a great date time picker based on jQuery-ui http://trentrichardson.com/examples/timepicker/, but suddenly realized that i can't modify date format... Tried something like this:
jQuery('.datetimepicker').datetimepicker({
timeFormat: 'HH:mm'
}).formatDate('yy-mm-dd');
Can someone show an example on it?
Upvotes: 5
Views: 13515
Reputation: 755
Just to add that none of the above worked for me, but the following did:
$(".datetimepicker").DateTimePicker({
dateFormat: 'yyyy-mm-dd'
});
Regards
Liam
Upvotes: 0
Reputation: 6996
Yes it is possible, have a look at the dateFormat
option in the API Documentation for the datepicker
This will work,
jQuery('.datetimepicker').datetimepicker({
timeFormat: 'HH:mm',
dateFormat: "yy-mm-dd"
});
Upvotes: 2
Reputation: 5461
yes it is possible to format the date. Refer the link given in this API
$.datepicker.formatTime(format, timeObj, options)
Refer the Formatting tab in this url. At the bottom of page u find the option to format a date
Upvotes: 1
Reputation: 259
POSSIBLE, heres an example link. extracting from this example souldnt be a problem i guess :)
http://jqueryui.com/resources/demos/datepicker/date-formats.html
Upvotes: 0
Reputation: 425
Try this :
jQuery('.datetimepicker').datetimepicker({ dateFormat: "D MM d, yy" });
and see this for more documentation : http://trentrichardson.com/examples/timepicker/#tp-formatting
Upvotes: 0
Reputation: 20364
You can use the code:
jQuery('.datetimepicker')
.datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: 'HH:mm'
});
Upvotes: 6
Reputation: 32581
Try this:
This will set the date format to "yy-mm-dd"
$.datepicker._defaults.dateFormat = "yy-mm-dd";
Upvotes: 2