为什么 Google API 无论输入如何设置 +01 偏移量?
Why does Google API set +01 offset no matter input?
我在 this page.
上使用 Google 的 API 日历浏览器 API
我正在插入一个事件 { "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 字段。
为什么会这样?还有,有没有 "right way" 或者我只需要在设置时间时考虑这个增加的小时数?
我建议使用 timeZone
属性 来正确指定时区。
示例请求使用 "timeZone":
"Europe/Stockholm"
:
{
"end": {
"dateTime": "2016-10-31T06:30:00",
"timeZone": "Europe/Stockholm"
},
"start": {
"dateTime": "2016-10-31T06:00:00",
"timeZone": "Europe/Stockholm"
}
}
我在 this page.
上使用 Google 的 API 日历浏览器 API我正在插入一个事件 { "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 字段。
为什么会这样?还有,有没有 "right way" 或者我只需要在设置时间时考虑这个增加的小时数?
我建议使用 timeZone
属性 来正确指定时区。
示例请求使用 "timeZone":
"Europe/Stockholm"
:
{
"end": {
"dateTime": "2016-10-31T06:30:00",
"timeZone": "Europe/Stockholm"
},
"start": {
"dateTime": "2016-10-31T06:00:00",
"timeZone": "Europe/Stockholm"
}
}