弹性时区转换 [英] Flex- Time Zone Conversion

查看:103
本文介绍了弹性时区转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在flex4中将日期和时间转换为CDT时区

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

关于, 苏什马

推荐答案

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;

但是,您正在尝试获取CDT的实际时间,该时间仅在夏季的某些地区有效.为此,除非您为异常编写代码,否则Flash不可能确切知道什么时候(例如,如果在该日期和该日期之间,则执行-6,否则执行-5),并且您还需要知道用户的实际位置(除非用户提供了该信息,否则无法通过Flash进行此操作.)

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?

这篇关于弹性时区转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆