为什么Google API无论输入都设置了+01偏移量? [英] Why does Google API set +01 offset no matter input?

查看:130
本文介绍了为什么Google API无论输入都设置了+01偏移量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本页



我插入一个事件 {end:{dateTime:2016-10- 31T06:30:00Z},start:{dateTime:2016-10-31T06:00:00Z}} 并尝试过以下日期时间格式:

  2016-10-31T06:00:00Z 
2016-10-31T06:00:00-00:00
2016 -10-31T06:00:00 + 00:00

但无论输入格式如何,Google都会选择在设置日期时间时添加一小时。回应总是:

 start:{
dateTime:2016-10-31T07:00 :00 + 01:00

我目前在斯德哥尔摩, +2小时抵消。我已经尝试设置单独的time_zone字段并省略单独的time_zone字段。



为什么会发生这种情况?而且,有没有什么正确的方法,或者我只需要在设置时间时考虑这个小时?

我建议您使用



使用timeZone的示例请求: Europe / Stockholm

  {
end:{
dateTime:2016-10 -31T06:30:00,
timeZone:欧洲/斯德哥尔摩
},
开始:{
dateTime:2016-10-31T06 :00:00,
timeZone:Europe / Stockholm
}
}


I'm using Google's API Explorer for their Calendar API on this page.

I am inserting an event { "end": { "dateTime": "2016-10-31T06:30:00Z" }, "start": { "dateTime": "2016-10-31T06:00:00Z" } } and have tried the following datetime formats:

2016-10-31T06:00:00Z
2016-10-31T06:00:00-00:00
2016-10-31T06:00:00+00:00

But no matter input format, Google chooses to add an hour when setting the datetime. The response is always:

"start": {
 "dateTime": "2016-10-31T07:00:00+01:00"
}

I'm currently in Stockholm, which has +2 hours offset. I've tried both setting the separate time_zone field and omitting the separate time_zone field.

Why is this happening? And, is there any "right way" or do I simply need to take this added hour into account when setting time?

解决方案

I suggest to use the timeZone property to specify the time zone properly.

Sample request using the "timeZone":"Europe/Stockholm":

{
 "end": {
  "dateTime": "2016-10-31T06:30:00",
  "timeZone": "Europe/Stockholm"
 },
 "start": {
  "dateTime": "2016-10-31T06:00:00",
  "timeZone": "Europe/Stockholm"
 }
}

这篇关于为什么Google API无论输入都设置了+01偏移量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆