设置浏览器时区(超过四个字母) [英] Set Browser Time zone (more than four letters)
问题描述
SET TZ = AEST -9
c:\程序文件(x86)\ Mozilla Firefox \ firefox.exe
测试: https:// whoer .net /
。注意它是如何显示AES而不是AEST的,并且-9没有被识别。
不确定是否有解决方法,您可以更改操作系统通过浏览器的时间是惊人的。但我想我会问,有没有人得到解决这个问题?
如果我把 UTC -9
会工作,但我测试的单词超过3个字母。
一些事情:
-
TZ
变量必须符合所描述的第一种或第二种格式的POSIX时区规范这里。您的字符串中的空格使标识符无效。
通常使用澳大利亚东部标准时间(即UTC)使用的AEST +10,而不是UTC + 9。
- 由于POSIX表单的符号相反,所以可以使用
AEST- 10
如果你打算代表在昆士兰的时间是UTC + 10全年。
-
如果你打算代表新南威尔士州),那么你需要一个更复杂的标识符来表示当前的时区规则:
AEST-10AEDT,M10.1.0,M4.1.0 / 3
-
一般来说,在大多数情况下,不应使用POSIX时区字符串。它们不足以与世界上所有的时区一起工作,因为它们不能代表一年的历史变化或两次以上的过渡。这也在时区标记wiki 中讨论。
TZ
变量的第三种格式,它是 IANA tzdb标识符,例如澳大利亚/布里斯班
或澳大利亚/悉尼
,但是这在Windows操作系统上不起作用。一般来说,设置TZ
变量,你可以在Linux,OSX等等中使用它。 在Windows上是不可靠的,因为只有某些API会使用它。例如,Windows C运行时库的 - 由于POSIX表单的符号相反,所以可以使用
localtime
函数将使用 TZ
变量,但是Win32 API的 TZ 变量在所有情况下都能正常工作是不合理的。事实上,尽管FireFox目前正在运行,但在未来的发行版中可能会停止使用它,而且对于Chrome和Edge等其他浏览器也无效。 目前还没有可靠的方法来设置Windows上的单个进程的时区。 SET TZ=AEST -9
"c:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Test against: https://whoer.net/ . Notice how it displays AES and not AEST and the -9 does not get recognized.
Not really sure if there is a workaround for this and the fact you can change your OS time through your browser is amazing. But thought I'd ask, has anyone gotten around this issue?
If I put in UTC -9
that would work but I'm testing for words above 3 letters.
A few things:
- The
TZ
variable must meet the POSIX time zone specification, of the first or second formats described here. The space in your string makes the identifier invalid. AEST
is typically used for Australian Eastern Standard Time, which is UTC+10, not UTC+9.- As the POSIX form has the sign inverted, you would use
AEST-10
if you intended to represent the time in Queensland that is UTC+10 year-round. If you meant to represent NSW (Sydney, etc.), then you need a much more complex identifier to represent the current time zone rules:
AEST-10AEDT,M10.1.0,M4.1.0/3
In general, POSIX time zone strings should not be used in most cases. They are insufficient to work with all the time zones of the world, as they cannot represent historical changes or more than two transitions in a year. This is also discussed in the timezone tag wiki.
- As the POSIX form has the sign inverted, you would use
Ideally, you'd use the third format of the
TZ
variable, which is an IANA tzdb identifier, such asAustralia/Brisbane
orAustralia/Sydney
, however this will not work on Windows OS. You can only use this for Linux, OSX, etc.In general, setting the
TZ
variable on Windows isn't reliable, as only certain APIs will use it at all. For example, the Windows C Run-Time Library'slocaltime
function will useTZ
variable, but the Win32 API'sGetTimeZoneInformation
function will not. Since one generally has no idea what the internals of the application are doing, it's not reasonable to expect theTZ
variable to function in all cases. Indeed, while FireFox currently works, it may stop working with it in some future release - and it doesn't work for other browsers like Chrome and Edge.There currently is no reliable way to set the time zone for a single process on Windows.
这篇关于设置浏览器时区(超过四个字母)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!