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".

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

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀