admin管理员组

文章数量:1289543

Is there a working jQuery plugin (or a javascript 'library') for formatting datetimes? I found some, but they were:

  • not working with hours and minutes (the one from datapicker)
  • not fully functional - can't give you names of months, leading zeroes, etc.
  • are just a piece of code written in some blog.

Of course I can implement it, but it'd be better to reuse one. I seek functionality similar to Java's SimpleDateFormat

Is there a working jQuery plugin (or a javascript 'library') for formatting datetimes? I found some, but they were:

  • not working with hours and minutes (the one from datapicker)
  • not fully functional - can't give you names of months, leading zeroes, etc.
  • are just a piece of code written in some blog.

Of course I can implement it, but it'd be better to reuse one. I seek functionality similar to Java's SimpleDateFormat

Share Improve this question asked Aug 14, 2010 at 19:09 BozhoBozho 597k147 gold badges1.1k silver badges1.2k bronze badges
Add a ment  | 

4 Answers 4

Reset to default 4

I've written a JavaScript implementation of the format() method of Java's SimpleDateFormat: http://www.timdown.co.uk/code/simpledateformat.php

The code is a few years old and I'd do it a bit differently now, but it's well tested and works.

Did you try date.js ?

It has a pattern recognition to format dates that is easy to use and has plenty of localisation files available.

ie: Date.today().toString("d-MMM-yyyy HH:mm")

I use http://blog.stevenlevithan./archives/date-time-format

Not sure whether it fits all your requirements, but this looks good one:

  • jquery-dateFormat

本文标签: javascriptjQuery datetime formatterStack Overflow