Flex- Time Zone Conversion

点点圈 提交于 2019-12-13 21:58:17

问题


How to convert date and time to CDT time Zone in flex4

Regards, Sushma


回答1:


The Date object in Flash is always set to the computer's time settings. If the computer is already in the CDT timezone, then just getting any property from the object will be good. However, if you want to do a timezone 'conversion' into a timezone that the computer is not set to, you can get the UTC time and offset it like this:

var date:Date = new Date();
var timezone:int = -5;
date.hours = date.hoursUTC + timezone;

However, you're trying to get the actual CDT time, which only works during the summer in certain areas. For this, it's impossible for Flash to know exactly when that is UNLESS you code the exceptions (ie. if between this date and that date, do -6, else do -5) and you also need to know the actual location of the user (which is impossible through Flash unless the user gives you that info).

Can I ask why you need to know such a thing?



来源:https://stackoverflow.com/questions/5673305/flex-time-zone-conversion

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!