开发者

Display datetime in actionscript with no timezone or daylight savings time changes?

In actionscript I am trying to format datetime fields coming in from a webservice call which takes into account the timezone and daylight savings time. Basically we need to display times for events, here in our TZ at the time it will be on that day. The following function works for timezones but we recently found that all of the upcoming times after the daylight savings time are being shifted an hour forward.

Is there a better way to handle this?

public function getTimeZoneFix(fixDate:Date):Date {
     var GMTHour:Number = 4; // our timzone offset
     开发者_高级运维var gmtDate:Date = new Date(fixDate);
     var hourOffset:Number = gmtDate.getTimezoneOffset() / 60 - GMTHour;
     gmtDate.setHours(gmtDate.getHours() + hourOffset );
     return gmtDate;             
}


Have a look on the following: http://thanksmister.com/2011/10/06/determining-local-timezone-in-actionscript-air-flex-as3/

It may help.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜