简体   繁体   中英

How to format datetime with the datetimepicker plugin?

What I want is a format like this:

Thu ,  13 March 2013 03:28pm 

Here is what I've tried so far:

$('.datetimepicker').datepicker({
   dateFormat : 'D , d M yy hh:mm'
});

This is the result I got:

Thu , 13 March 2013 hh:03

What can I do to get the desired format?

See this: Fiddle

Reference Link

 $('.datetimepicker').datetimepicker();

use the following code:

$('.datetimepicker').datepicker({
   dateFormat: 'D , d M yy', timeFormat: 'hh:mm TT'
});

In it small m is represent the numeric month. Above code will work for you. For reference check this link .

Out of the box the jQuery UI datepicker does not provide the time as a possible format. See the documentation .

I don't think you can achieve it since dateFormat is just for datepicker , you need to achieve it through timepicker as well. Here is a blog stated how you can obtain it:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM