dongmo20030416 2014-02-14 09:46
浏览 155

PHP - ew DateTimeZone(),UTC-5或UTC + 5

How I can create a new date with different timezone? I have tested many ways, but doesn't work, example

$date = new DateTimeZone('UTC+5');

My goal is to create the $date, then convert it to "UTC-5" format.

  • 写回答

1条回答 默认 最新

  • doulu6929 2014-02-14 10:07
    关注

    UTC+5 is not a timezone, it's an offset. A location on earth, say, New York, America, has a local time which is x hours different from the UTC standard time. That's the offset, like UTC-5. However, this offset changes throughout the year based on daylight saving time. In winter the offset may be -5, but in summer -6. A timezone is something which describes this clearly, it's a ruleset for what offset the local time is to UTC and when that offset changes. A timezone is specific to a location and is called, for example, America/New_York.

    Therefore, working with "UTC-5" offsets is pretty meaningless, and what you really want to do is use a timezone for the location you're working with.

    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号