duankui6150 2014-05-22 05:17
浏览 63
已采纳

当唯一的信息是UTC偏移号时,设置用户的时区。

Is there a timezone 'code' that includes the offset (for example: -7) that the function date_default_timezone_set() would accept? (I only have the offset number, and not something specific like America/Phoenix).

I'm setting timezones based off of Facebook's API, when I extract the user's information.

  • 写回答

2条回答 默认 最新

  • dongtuan8547 2014-05-22 13:41
    关注

    No. Time zones don't work that way. A time zone offset only applies to a specific point in time. Many time zones share the same offset at various times. Some are indistinguishable from others with an offset alone.

    For example, -7 could be MST, or it could be PDT. It might be used with "America/Phoenix", which is on MST year-round. But it might belong to "America/Denver" which would use MST (-7) in the winter and MDT (-6) in the summer. Or it might belong to "America/Los_Angeles", using PST (-8) on the winter and PDT (-7) in the summer.

    See also, the timezone tag wiki

    Regarding Facebook, it's only giving you the time zone offset as of the user's last login. It is not necessarily even the correct offset for the current moment in time.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 关于php中URL传递GET全局变量的问题
  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理
  • ¥15 STM32无法向设备写入固件