Friday, 20 March 2009

Playing with the JavaScript Date Object

I've been working on a couple of projects that require manipulation of the date strings in one way or another, and one of the things I wanted to achieve was to show a posting date in a list built from RSS, but this meant I would need to convert ISO Date format used in the Blogger RSS feed to a prettier format.

After a bit of Googling and tweaking code, I found a solution, which I will post at a later date, but in the meantime, here's a list of a few useful links relating to manipulating dates using JavaScript.
  1. DateJs - Very useful little JavaScript utility for working with dates.
  2. Parsing W3C's ISO 8601 Date/Times in JavaScript - Useful script that uses Regular Expressions to handle ISO Format Dates.
  3. JavaScript Date Object -Estelle Weyl's useful article giving an overview of the JavaScript date object.
  4. JavaScript Toolbox Date Formating - A useful library contains functions to deal with dates in Javascript, parse date strings, format dates to different output strings, and compare dates.
  5. JavaScript Pretty Date - John Resiq's function to convert dates to "web 2.0" style strings, eg Something like "2008-01-28T20:24:17Z" would become "2 hours ago".
  6. JavaScript ISO8601/RFC3339 Date Parser -Another approach to formatting ISO dates.
  7. PHPDate - Jon Combe's jQuery port of PHP's Date function. Very useful!
  8. JavaScript Source Date & Time - A list of scripts that might come in handy for some readers.
  9. JavaScript date string formatting - Svend Tofte's interesting script. again, based on PHP's date function.
  10. JavaScript Date Formatting - An Unorthodox Way -Most date formatting implementations use format strings where format specifiers like “mm”, “mmm”, “HH”, etc. are used for selecting different components of a date. Ates Goral tackles the date object from a different angle.

No comments:

Post a Comment