dongqu5650 2017-03-10 18:23
浏览 295

我需要UTC-8 / GMT-8作为php时区。 我不能使用美国\洛杉矶,因为它节省了一天的时间

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?

  • 写回答

1条回答 默认 最新

  • doujia1904 2017-03-12 06:12
    关注

    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, or America/Whitehorse.

    评论

报告相同问题?

悬赏问题

  • ¥15 安装svn网络有问题怎么办
  • ¥15 Python爬取指定微博话题下的内容,保存为txt
  • ¥15 vue2登录调用后端接口如何实现
  • ¥65 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 latex怎么处理论文引理引用参考文献