Best JavaScript Date Parser & Formatter?

Since I started using jQuery, I did a lot more JavaScript development.

I need to parse different date formats and then display them in a different format.

Do you know what a good tool to do this?

Which one would you recommend?

+54
javascript jquery datetime formatting parsing
Oct. 15 '08 at 22:36
source share
7 answers

Update 2014: Moment.js is an excellent date processing library that includes parsing functions. It does not include automatic date format detection, but you can specify several parsing patterns .

Do you know the format of dates before hand, or are they entered by the user?




Deprecated datejs date parsing library . It has not been updated since 2007.

+38
Oct 15 '08 at 22:39
source share

If you are already using jqueryUI on the page than $ .datepicker has the functions parseDate () and formatDate (), which are enough in most cases. As for DateJS - profile code u, and you will see how baggy it is and how much time it spends when handling exceptions

+10
Dec 17 '10 at 8:53
source share

Take a look at this very good article: JavaScript Date Formatting Tests

+5
Oct. 15 '08 at 23:08
source share

I found a jQuery globalization module to work better. Other methods had problems with the cross browser, and things like date.js did not update for quite some time.

You also don't need datePicker on the page. You can simply call something similar to the example specified in the docs:

$.parseDate('yy-mm-dd', '2007-01-26'); 
+5
Dec 30 2018-10-12
source share

Another option (which I wrote is full disclosure):

DP_DateExtensions library

Supports date and time formatting, date math (date adding / subtracting details), date matching, parsing, etc. It is liberally disclosed.

I really like Date.js, but finding the syntax is cumbersome. Most of the functions at my core (at least in part) are based on a rich set of functions in CFML - some people may find it a little more comfortable.

There is no reason to consider this if you are already using the framework (they are all capable), but if you just need to quickly add date manipulations to the project, give it a chance.

+3
Aug 14 '09 at 15:32
source share

Ext.Date . It uses the same formatting codes as the PHP date () function, but also allows you to parse in a specific format (which PHP does not).

+2
Oct 15 '08 at 22:39
source share

The link below may be useful for formatting the date present in html elements

http://snipplr.com/view/50172/jquery-date-formator-plugin/

0
Mar 10 '11 at 8:20
source share



All Articles