user1715688
user1715688

Reputation: 11

Zend Google Calendar API - Add Event is One Hour off

When I add an event using the Zend API the time is one hour off on the summer daylight savings time months.

The string I use for the date to add is "2012-10-02T06:00:00-05:00". I'm in the Eastern timezone and my Google Calendar is also setup for Eastern, but the time displays as 7am. I've also tried "2012-10-02T06:00:00.000-05:00".

I've also tried using date_default_timezone_set("America/Detroit").

Any ideas? I've been researching and trying to fix this for awhile now.

Thanks.

Upvotes: 1

Views: 927

Answers (3)

mralexlau
mralexlau

Reputation: 1993

If you look at the google calendar API, you'll notice that event dateTime's must be passed in the RFC 3339 format (as you're already aware of based on the example you gave in your question).

The specification for the rfc 3339 format states:

Because the daylight saving rules for local time zones are so convoluted and can change based on local law at unpredictable times, true interoperability is best achieved by using Coordinated Universal Time (UTC). This specification does not cater to local time zone rules.

which basically means that this specification does not account for DST. Basically you're responsible for adjusting for DST on your end before passing a date to the Google Calendar API.

Upvotes: 0

user986687
user986687

Reputation: 11

I do apply a timezone identifier to my entries. I use -05:00 --> "2012-10-02T06:00:00-05:00"

I thought setTimezone only applies to Zend_Date

Upvotes: 1

RockyFord
RockyFord

Reputation: 8519

Zend_Gdata_Calendar_EventEntry allows you to call getTimezone() and setTimezone() also you should be able to apply a timezone identifier to your entry or a UTC offset.

"end": {
  "dateTime": "2012-07-12T10:30:00.0z" //z is identifier for UTC
 },
 "start": {
  "dateTime": "2012-07-12T09:30:00.0z"
 }

"start": {
  "dateTime": "2012-07-11T03:30:00-06:00" //-06:00 would be UTC offset
},
"end": {
  "dateTime": "2012-07-11T04:30:00-06:00"
}

Upvotes: 0

Related Questions