We all know that trace(new Date()) traces the date as a string that looks like “Mon Jul 12 13:20:09 GMT+0800 2004”

How to convert this String back to Date? There is no built in method, so I’ve written this function to do that.


#includegetDateFromString.as//sample date in Pacific Daylight Time var str = “Sun Aug 11 17:00:00 GMT-0700 1974“; trace(getDateFromString(str)); //traces “Mon Aug 12 08:00:00 GMT+0800 1974” on my machine (Singapore Time) //output will be in local time and will vary accordingly

You may download the ‘getDateFromString.as’ from here