Im implementing this integration with Google Calendar (using the google API SDK for PHP) where some events in our system are sent to Calendar using the API
Ive already got it working except for one thing: events always appear in Calendar with the wrong time, always -3 hours for any date/time I sent
My calendar is set to São Paulo timezone, which is GMT-3, so it looks like its converting the times. But I dont want that, Im already sending the right times, and it is done no matter how I sent the datetimes
I tried, for ex:
Array
(
[summary] => test
[location] => test
[description] => test
[start] => Array
(
[dateTime] => 2023-03-30T00:00:00+00:00
)
[end] => Array
(
[dateTime] => 2023-03-31T23:59:59+00:00
)
)
And also (timezone applied to the datetime):
Array
(
[summary] => test
[location] => test
[description] => test
[start] => Array
(
[dateTime] => 2023-03-29T21:00:00-03:00
)
[end] => Array
(
[dateTime] => 2023-03-31T20:59:59-03:00
)
)
And also sending the timezone:
Array
(
[summary] => test
[location] => test
[description] => test
[start] => Array
(
[dateTime] => 2023-03-30T00:00:00+00:00
)
[end] => Array
(
[dateTime] => 2023-03-31T23:59:59+00:00
)
)
And finally, both:
Array
(
[summary] => test
[location] => test
[description] => test
[start] => Array
(
[dateTime] => 2023-03-29T21:00:00-03:00
[timeZone] => America/Sao_Paulo
)
[end] => Array
(
[dateTime] => 2023-03-31T20:59:59-03:00
[timeZone] => America/Sao_Paulo
)
)
It makes no difference: when I look in Calendar, the event will be always at:
March 29, 2023, 9:00pm – March 31, 2023, 8:59pm
What am I doing wrong here? How can I have Calendar show the event with the times I sent it?
You'll need to specify the timezone only and without changing the start/end time:
Array
(
[summary] => test
[location] => test
[description] => test
[start] => Array
(
[dateTime] => 2023-03-30T00:00:00-03:00
)
[end] => Array
(
[dateTime] => 2023-03-31T23:59:59-03:00
)
)
That way calendars in GMT-3 America/Sao_Paulo will see the event starting at 30/03 0 hours.