1
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.

1 Answers1

1

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.

  • Ideally, you'd use the third format of the TZ variable, which is an IANA tzdb identifier, such as Australia/Brisbane or Australia/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's localtime function will use TZ variable, but the Win32 API's GetTimeZoneInformation function will not. Since one generally has no idea what the internals of the application are doing, it's not reasonable to expect the TZ 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.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
  • 1
    I see. I might dual boot with Linux as I could then do this with Chrome and Firefox with more flexibility. –  Jul 24 '17 at 23:21