如何在 ActionScript 中获取本地系统时区?

How to get local system timezone in ActionScript?

我想使用 ActionScript 3 查找本地系统时区,我尝试了很多方法但无法获得任何解决方案,如果我愿意 select (UTC -8:00) )Pacific Time 那么结果将是 UTC -8:00 或 (UTC -8:00)Pacific Time (UTC 时区的结果)。

所以如果有人知道如何实现这个请帮我解决这个问题。

提前致谢。

您可以使用 Date 对象的 getTimezoneOffset 函数来获取特定日期相对于 UTC 的偏移量。 Reference Here.

请注意,此偏移量可能会因提供的日期而异。在美国太平洋时区,冬季使用UTC-8,夏季使用UTC-7,夏令时生效。

请注意,API 仅适用于 offset。 ActionScript 中没有 API 可以为您提供机器的本地 时区 ID,例如 America/Los_Angeles (IANA) 或 Pacific Standard Time (Windows).请参阅 timezone tag wiki 中的 "Time Zone != Offset"。

我很确定你会

var date:Date = new Date() 

那么日期将采用本地浏览器时间