simple question, but cannot seem to find an answer
I need to set a timezone to UTC-8 and only UTC-8 [GMT-8 is actually the same]. It cannot be a timezone with daylight time saving.
Now PHP does not seem to provide a way to set to GMT-8, when using Etc/GMT-8
I get the wrong time [I get an offset way earlier]
like it says in the DOCS
Now I could use GMT+8 to achieve GMT-8 [sounds odd but i Quote:
Warning If you disregard the above warning, please also note that the IANA timezone database that provides PHP's timezone support uses POSIX style signs, which results in the Etc/GMT+n and Etc/GMT-n time zones being reversed from common usage. For example, the time zone 8 hours ahead of GMT that is used in China and Western Australia [among other places] is actually Etc/GMT-8 in this database, not Etc/GMT+8 as you would normally expect.
as there is no country in exactly UTC-8, i cannot put a country there...
so I use Etc/GMT+8 and cross the fingers they wont change it?
asked Mar 10, 2017 at 18:23
1
Yes, you can absolutely
use Etc/GMT+8
for a time zone that is fixed to UTC-8. No, it won't change. IANA time zone names are identifiers, and they are guaranteed to not be removed from the tz database.
That said, I'd ask you to question why you need a UTC-8 fixed offset time zone:
Is it because you are referencing time on Pitcairn Islands [population 49]? If so, use
Pacific/Pitcairn
.Is it because you are calculating time for a ship at sea that is traveling between 112.5°W and 127.5°W latitude? If so, use
Etc/GMT+8
.Is it because you think DST isn't important, or you don't like it, or you were given a requirement that doesn't include it, etc? Sorry, but like it or not - the people who physically occupy these areas do use DST. If you elect not to, your clock will disagree with theirs for a considerable part of the year. Use
America/Los_Angeles
,America/Tijuana
,America/Vancouver
,America/Dawson
, orAmerica/Whitehorse
.
answered Mar 12, 2017 at 6:12
Matt Johnson-PintMatt Johnson-Pint
218k73 gold badges428 silver badges544 bronze badges
1