Google 日历时区不正确
Google calendar timezone is not proper
我将下面的数组发送到 google api 以将事件保存到 google 日历中,但它显示在错误的时间。
谁能帮帮我?
Array
(
[summary] => XXXXXXXXXXXXXXXXXXXX
[location] => XXXXXXXXXXXXXXXXXXX
[description] => XXXXXXXXXXXXXXXX
[start] => Array
(
[dateTime] => 2017-01-25T09:00:00+0000
[timeZone] => America/Toronto
)
[end] => Array
(
[dateTime] => 2017-01-25T09:30:00+0000
[timeZone] => America/Toronto
)
[attendees] => Array
(
[0] => Array
(
[email] => XXXXXXXXXXXXXXXXXXXXXXXXXXXX
)
[1] => Array
(
[email] => XXXXXXXXXXXXXXXXXXXXXXXXXXXX
)
)
[reminders] => Array
(
[useDefault] =>
[overrides] => Array
(
[0] => Array
(
[method] => email
[minutes] => 1440
)
[1] => Array
(
[method] => popup
[minutes] => 10
)
)
)
我正在发送 9:00 - 9:30 时间来保存事件,但它在我的 google 日历中显示为 2017 年 1 月 25 日,4:00-4:30 .我正在使用 PHP google 日历 api。
谢谢
我猜你只能放 2017-01-25T09:00:00
而没有 +0000
。您将使用 timeZone
属性 来正确指定时区。
您可以在中查看我的回答。
{
"end": {
"dateTime": "2017-01-25T09:30:00",
"timeZone": "America/Toronto"
},
"start": {
"dateTime": "2017-01-25T09:00:00",
"timeZone": "America/Toronto"
}
}
我已经使用 API 资源管理器对其进行了测试,它工作正常。
dateTime字段指定了事件发生的时间点,timezone只是在他们的timezone中显示给用户的装饰(除非offset被省略,然后取timezone的offset考虑)。 dateTime 字段中的偏移量对时间评估很重要(在您的情况下,您指定了 +0000,这意味着 "no offset from UTC")。
您有三个选择:
指定 UTC 时间 2017-01-25T14:00:00+0000(或更好的 2017-01-25T14:00:00Z)
指定多伦多偏移时间
2017-01-25T09:00:00-0500
完全省略偏移量 2017-01-25T09:00:00
我将下面的数组发送到 google api 以将事件保存到 google 日历中,但它显示在错误的时间。 谁能帮帮我?
Array
(
[summary] => XXXXXXXXXXXXXXXXXXXX
[location] => XXXXXXXXXXXXXXXXXXX
[description] => XXXXXXXXXXXXXXXX
[start] => Array
(
[dateTime] => 2017-01-25T09:00:00+0000
[timeZone] => America/Toronto
)
[end] => Array
(
[dateTime] => 2017-01-25T09:30:00+0000
[timeZone] => America/Toronto
)
[attendees] => Array
(
[0] => Array
(
[email] => XXXXXXXXXXXXXXXXXXXXXXXXXXXX
)
[1] => Array
(
[email] => XXXXXXXXXXXXXXXXXXXXXXXXXXXX
)
)
[reminders] => Array
(
[useDefault] =>
[overrides] => Array
(
[0] => Array
(
[method] => email
[minutes] => 1440
)
[1] => Array
(
[method] => popup
[minutes] => 10
)
)
)
我正在发送 9:00 - 9:30 时间来保存事件,但它在我的 google 日历中显示为 2017 年 1 月 25 日,4:00-4:30 .我正在使用 PHP google 日历 api。 谢谢
我猜你只能放 2017-01-25T09:00:00
而没有 +0000
。您将使用 timeZone
属性 来正确指定时区。
您可以在
{
"end": {
"dateTime": "2017-01-25T09:30:00",
"timeZone": "America/Toronto"
},
"start": {
"dateTime": "2017-01-25T09:00:00",
"timeZone": "America/Toronto"
}
}
我已经使用 API 资源管理器对其进行了测试,它工作正常。
dateTime字段指定了事件发生的时间点,timezone只是在他们的timezone中显示给用户的装饰(除非offset被省略,然后取timezone的offset考虑)。 dateTime 字段中的偏移量对时间评估很重要(在您的情况下,您指定了 +0000,这意味着 "no offset from UTC")。
您有三个选择:
指定 UTC 时间 2017-01-25T14:00:00+0000(或更好的 2017-01-25T14:00:00Z)
指定多伦多偏移时间 2017-01-25T09:00:00-0500
完全省略偏移量 2017-01-25T09:00:00