开发者

Get local time from UTC datetime in ActionScript 3

Does AS3 have a w开发者_StackOverfloway of converting a datetime variable into local time?


//Some date string you got from somewhere
var dateStr:String = "Sun Sep 25 22:30:33 GMT+0600 2011";
var date:Date = new Date(dateStr);

//Use date.toLocaleString() to get a local time string and create a new date from it
var localDate:Date = new Date(date.toLocaleString());
trace(localDate);'

Here's a link to date.toLocaleString() from Adobe

date.toLocaleString() Documentation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜