Best JavaScript Date Parser & Formatter? [closed]

Since I've started to use jQuery, I have been doing a lot more JavaScript development.

I have the need to parse different date formats and then to display them into another format.

Do you know of any good tool to do this?

Which one would you recommend?


Solution 1:

2014 update: Moment.js is an excellent date manipulation library, which includes parsing functions. It doesn't include automatic date format detection, but you can specify multiple parsing patterns.

Do you know the format of the dates before hand though, or are they user input?


A deprecated library for parsing dates is Datejs. It hasn't been updated since 2007.

Solution 2:

If you already use jqueryUI on the page, than $.datepicker has parseDate() and formatDate() functions that enough in most cases. As for DateJS - profile yu code and you'll see how it baggy and how much time it spends in handling exception