Google-Calendar API - 获取默认日历的偏移量
Google-Calendar API - get offset of the default calendar
我想在 Google 日历中创建一个事件,使用其 API 根据日历的时区将开始结束时间设置为 14:00-15:00
。继此 reference I can create an appointment but I have to pass dateTime formatted according to RFC3339。它需要知道日历时区的偏移量。
所以在这个 reference 之后我得到了默认的日历实例,但是它有没有偏移量的 timeZone
的名称。
根据默认日历的时区在 14:00-15:00
的特定日期创建事件的方法是什么?
要使用默认日历时区将使用 Zulu timezone,这意味着它 "has no offset from Coordinated Universal Time (UTC)" - +8 UTC,诸如此类。
示例来自 Events: insert Try-it:
{
"end": {
"dateTime": "2018-06-15T15:00:00Z"
},
"start": {
"dateTime": "2018-06-15T14:00:00Z"
},
"description": "test"
}
但如果反过来,您想使用特定时区,请删除 Z 并添加时区 属性
{
"end": {
"dateTime": "2018-06-15T15:00:00",
"timeZone": "Singapore"
},
"start": {
"dateTime": "2018-06-15T14:00:00",
"timeZone": "Singapore"
},
"description": "Singapore"
}
希望这个小示例对您有所帮助。
我想在 Google 日历中创建一个事件,使用其 API 根据日历的时区将开始结束时间设置为 14:00-15:00
。继此 reference I can create an appointment but I have to pass dateTime formatted according to RFC3339。它需要知道日历时区的偏移量。
所以在这个 reference 之后我得到了默认的日历实例,但是它有没有偏移量的 timeZone
的名称。
根据默认日历的时区在 14:00-15:00
的特定日期创建事件的方法是什么?
要使用默认日历时区将使用 Zulu timezone,这意味着它 "has no offset from Coordinated Universal Time (UTC)" - +8 UTC,诸如此类。
示例来自 Events: insert Try-it:
{
"end": {
"dateTime": "2018-06-15T15:00:00Z"
},
"start": {
"dateTime": "2018-06-15T14:00:00Z"
},
"description": "test"
}
但如果反过来,您想使用特定时区,请删除 Z 并添加时区 属性
{
"end": {
"dateTime": "2018-06-15T15:00:00",
"timeZone": "Singapore"
},
"start": {
"dateTime": "2018-06-15T14:00:00",
"timeZone": "Singapore"
},
"description": "Singapore"
}
希望这个小示例对您有所帮助。