Google calendar API time format

phoenix picture phoenix · Jul 11, 2012 · Viewed 18.9k times · Source

I was playing with Google calendar's API explorer and managed to get the events list from my calendar. And i managed to insert some events into the calendar from API explorer. But im confused with the time property.

When i inserted an event from explorer, i wanted event time to be from 09:30 to 10:30. So i put as following:

{
 "end": {
  "dateTime": "2012-07-12T10:30:00.0z"
 },
 "start": {
  "dateTime": "2012-07-12T09:30:00.0z"
 }
}

Insertion was successful. But when i checked the calendar, its showing that event's time as 03:30-04:30. Date is correct. Any idea where i went wrong?


And when i retrieved the same event using the explorer, i got this:

"start": {
  "dateTime": "2012-07-11T03:30:00-06:00"
},
"end": {
  "dateTime": "2012-07-11T04:30:00-06:00"
}

Please notice the time now => 03:30:00-06:00 and 04:30:00-06:00. What is that -06:00?

Answer

Claudio Cherubino picture Claudio Cherubino · Jul 11, 2012

When you are inserting the event, you are doing that in the UTC timezone (notice the 'z' at the end of the value), but your calendar is probably in a different timezone. The -06:00 indicates the UTC-6 timezone which should be Central Standard Time.