from: http://www.computus.org/journal/?p=44
Inside the AS3 Date class: Timezones and Daylight Saving Time
Local time
The same moment in time has a unique local interpretation depending upon the time of year and your position on Earth. The operating system provides the Flash Player with two local temporal modifiers: One for Time zone designation (TZD) and one for Daylight saving time (DST). Local time is derived by applying these modifiers to the value of UTC.
Local time = UTC + TZD + DST
swf see the attachment. timezone.swf
Timezones: from ‘Keeping Track of Time with Flash MX’‘, New Riders 2002
Time zone (TZD)
If you ask two people at different longitudes “what time is it?” you will get two different answers. For example, when it is 11 am in New York, it is 4 pm in London and 1 am the following day in Tokyo. This is because the Earth is divided longitudinally (pole to pole) into 24 time zones spaced 15° apart. The areas within each time zone observe a local or ‘civil time’ one hour earlier than the zone immediately to the east.
Gotcha: Territories on a zone boundary decide which side of the zone they wish to be on. Consequently very few of the lines dividing the time zones are actually straight.
Daylight Saving Time (DST)
Thanks mainly to the efforts of a London builder named William Willett we have the controversial notion of daylight saving time (DST). This practice means that in some locations, all clocks are put one hour ahead of local (TZD) time during the summer months.
Gotcha: The Flash 5 Player incorrectly applies the DST rule for the US Pacific territory to all locations.
Gotcha: Although it’s easy to determine whether DST is in effect at the end user’s location, it’s a much bigger problem to determine it for any other location. The rules for DST are a muddy political affair that vary greatly from location to location, and year to year.
Determining the values of TZD and DST
It is often useful to know the difference between the current local time and the current UTC time. The following property returns the difference, measured in minutes.
var tzo:Number = d.timezoneOffset |
Gotcha: The term ‘timezoneOffset’ is a bit of a red herring as this value contains the combined offset for timezone and Daylight Saving Time.
The following code can be used to determine the individual values of TZD and DST. Both functions return their offsets in milliseconds.
public static function getTimezone():Number { // Create two dates: one summer and one winter var d1:Date = new Date( 0, 0, 1 ) var d2:Date = new Date( 0, 6, 1 ) // largest value has no DST modifier var tzd:Number = Math.max( d1.timezoneOffset, d2.timezoneOffset ) // convert to milliseconds return tzd * 60000 } public static function getDST( d:Date ):Number { var tzd:Number = getTimezone() var dst:Number = (d.timezoneOffset * 60000) - tzd return dst }
相关推荐
Android MTK 时区添加所用到的文件,方法在我的博客里有
if your system lose some Time Zones, you can use this reg file to recover them.
python库。 资源全名:timezones-1.4.tar.gz
npm install --save countries-and-timezones 浏览器 将以下脚本添加到您的项目中(仅〜9kb): <!-- Latest version --> < script src =" ...
timezones.json
Laravel开发-timezones Laravel框架。
timeZones: [ "Asia/Kabul" ], UTCOffset: [ "UTC +04:30" ] } timeZones和UTCOffset数组与时区及其对应的UTCOffset匹配。 尽管有些国家/地区像这样一个时区: { countryCode: "CL", countryName: ...
资源分类:Python库 所属语言:Python 资源全名:facebook_timezones-0.1-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
16 Sep 2015 16:36:32 IRDT (Origin)Wed, 16 Sep 2015 12:06:32 UTCWed, 16 Sep 2015 14:06:32 CESTWed, 16 Sep 2015 05:06:32 PDTWed, 16 Sep 2015 07:06:32 CDTWed, 16 Sep 2015 08:06:32 EDT$ timezones -...
Laravel开发-timezones-test Laravel框架。