How to format date with hours, minutes and seconds when using jQuery UI Datepicker?

NETCreator Hosting picture NETCreator Hosting · Jul 3, 2013 · Viewed 290.2k times · Source

Is it possible to format a date with jQuery UI Datepicker as to show hours, minutes and seconds?

This is my current mockup:

When I call .datepicker({ dateFormat: 'yyy-dd-mm HH:MM:ss' }) the returned value is:

201313-07-03 HH:July:ss

Here is a JSFiddle.

Answer

scel.pi picture scel.pi · Jul 3, 2013
$("#datepicker").datepicker("option", "dateFormat", "yy-mm-dd ");

For the time picker, you should add timepicker to Datepicker, and it would be formatted with one equivalent command.

EDIT

Use this one that extend jQuery UI Datepicker. You can pick up both date and time.

http://trentrichardson.com/examples/timepicker/