Parsing ISO 8601 date in Javascript

Slythic picture Slythic · Jan 28, 2011 · Viewed 115.5k times · Source

Need help/tips on converting an ISO 8601 date with the following structure into javascript.

CCYY-MM-DDThh:mm:ssTZD

I'd like to format the date like so:

January 28, 2011 - 7:30PM EST

I'd like to keep this solution as clean and minimal as possible.

Answer

Rob Evans picture Rob Evans · Apr 7, 2014

The Date object handles 8601 as it's first parameter:

var d = new Date("2014-04-07T13:58:10.104Z");
console.log(d.toString());