/ Published in: ActionScript 3
probably not the best way but easy enough
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//trace(new Date("2010/05/03T14:14Z")); ----> this will error 'invalid date' var isoDate = "2010-05-03T14:14Z"; //this will remove the T and Z var date = isoDate.replace(/[A-Z]/gi," "); //this will replace the hypens with forward slashes date = date.replace(/\-/gi, "/"); //this casts the string to date and creates the correct date object trace(new Date(date));