Google不会为某些日历返回时区

时间:2017-08-02 13:32:27

标签: java google-api calendar google-calendar-api

我正在使用Google Calendar API V3,在处理Google提供的时区方面存在一些困难。 在日历文档中:Calendars Overview

据说日历的时区是可选字段:

  

的timeZone
      串
      日历的时区。 (格式化为IANA时区数据库       名称,例如“欧洲/苏黎世”。)可选。   但是,它在CalendarList(https://developers.google.com/google-apps/calendar/v3/reference/calendarList)中也是可选的。

如果在两种情况下均未指定时区,Google会假设时区是什么时候?

1 个答案:

答案 0 :(得分:2)

假设时区是日历本身设置的时区。

请求:

  

获取https://www.googleapis.com/calendar/v3/calendars/primary

响应

{
 "kind": "calendar#calendar",
 "etag": "\"LOjlc76YTigzSZVQwSEE/E756z8zuickcYzaOnj8krCN4-Pk\"",
 "id": "xxxx@gmail.com",
 "summary": "xxx@gmail.com",
 "timeZone": "Europe/Copenhagen"
}

创建新日历而不设置时区结果

{
 "kind": "calendar#calendar",
 "etag": "\"W8S50vTLOjlc76YTigzSZVQwSEE/cBQwQ2pDeiLoQ406eiNPZrDEINc\"",
 "id": "ddd5qep4g260mm7fgq8vtgp18@group.calendar.google.com",
 "summary": "testone",
 "timeZone": "UTC"
}
相关问题