drqn5418 2015-12-21 11:32
浏览 12
已采纳

查询夏季的GMT日期时间

I need to send a querystring parameter to our API server which is taking times in GMT format. I am a bit confused about what values I need to send during the summertime, since the dates are in GMT format.

Let's assume we are in London (UK), it's 3PM, and it's the 15th of May 2016.

Is the correct date value:

?date=2016-05-15T15:00:00Z

or

?date=2016-05-15T15:00:00+01:00

or

?date=2016-05-15T16:00:00Z (assuming I always want to use the Z "Zulu Time")
  • 写回答

1条回答 默认 最新

  • drjmrg8766 2015-12-21 18:32
    关注

    Since London is in BST on that date, then 2016-05-15T15:00:00+01:00 would be the most fully qualified correct form.

    If you were to normalize that to UTC, then it would become 2016-05-15T14:00:00Z. Z is equivalent to +00:00, so you have to adjust the hour by the inverse of the original offset.

    2016-05-15T15:00:00Z is incorrect, as that is an hour later.

    As to which of the two correct forms are more correct for your particular API, there's no way to answer that as you gave no details about how the API is designed, what language it's implemented in, what code is parsing the input, etc. In many cases, either would be accepted. However if the API requires to know local time as well as the universal time, then only the 2016-05-15T15:00:00+01:00 for would convey both.

    Also, recognized that there's no such thing as "GMT format". GMT is a time zone, equivalent to UTC+00:00. What you actually have here is a string in ISO8601 extended format, also specified under RFC3339. This is commonly said to be the "ISO format".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料