开发者

Get local time from UTC datetime in ActionScript 3

开发者 https://www.devze.com 2023-04-07 02:50 出处:网络
Does AS3 have a w开发者_StackOverfloway of converting a datetime variable into local time?//Some date string you got from somewhere

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

精彩评论

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

关注公众号