从ActionScript 3中的UTC日期时间获取本地时间

时间:2011-09-25 13:30:03

标签: actionscript-3 utc localtime

AS3是否有办法将日期时间变量转换为本地时间?

1 个答案:

答案 0 :(得分:3)

//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);'

这是Adobe的date.toLocaleString()链接

date.toLocaleString() Documentation