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 }
相关推荐
python学习资源
jfinal-undertow 用于开发、部署由 jfinal 开发的 web 项目
基于Andorid的音乐播放器项目设计(国外开源)实现源码,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。
python学习资源
python学习资源
python学习一些项目和资源
【毕业设计】java-springboot+vue家具销售平台实现源码(完整前后端+mysql+说明文档+LunW).zip
HTML+CSS+JavaScarip开发的前端网页源代码
python学习资源
【毕业设计】java-springboot-vue健身房信息管理系统源码(完整前后端+mysql+说明文档+LunW).zip
成绩管理系统C/Go。大学生期末小作业,指针实现,C语言版本(ANSI C)和Go语言版本
1_基于大数据的智能菜品个性化推荐与点餐系统的设计与实现.docx
【毕业设计】java-springboot-vue交流互动平台实现源码(完整前后端+mysql+说明文档+LunW).zip
内容概要:本文主要探讨了在高并发情况下如何设计并优化火车票秒杀系统,确保系统的高性能与稳定性。通过对比分析三种库存管理模式(下单减库存、支付减库存、预扣库存),强调了预扣库存结合本地缓存及远程Redis统一库存的优势,同时介绍了如何利用Nginx的加权轮询策略、MQ消息队列异步处理等方式降低系统压力,保障交易完整性和数据一致性,防止超卖现象。 适用人群:具有一定互联网应用开发经验的研发人员和技术管理人员。 使用场景及目标:适用于电商、票务等行业需要处理大量瞬时并发请求的业务场景。其目标在于通过合理的架构规划,实现在高峰期保持平台的稳定运行,保证用户体验的同时最大化销售额。 其他说明:文中提及的技术细节如Epoll I/O多路复用模型以及分布式系统中的容错措施等内容,对于深入理解大规模并发系统的构建有着重要指导意义。
基于 OpenCV 和 PyTorch 的深度车牌识别
【毕业设计-java】springboot-vue教学资料管理系统实现源码(完整前后端+mysql+说明文档+LunW).zip
此数据集包含有关出租车行程的详细信息,包括乘客人数、行程距离、付款类型、车费金额和行程时长。它可用于各种数据分析和机器学习应用程序,例如票价预测和乘车模式分析。
把代码放到Word中,通过开发工具——Visual Basic——插入模块,粘贴在里在,把在硅基流动中申请的API放到VBA代码中。在Word中,选择一个问题,运行这个DeepSeekV3的宏就可以实现在线问答
【毕业设计】java-springboot+vue机动车号牌管理系统实现源码(完整前后端+mysql+说明文档+LunW).zip
【毕业设计】java-springboot-vue交通管理在线服务系统的开发源码(完整前后端+mysql+说明文档+LunW).zip