I am trying to create a webpage and the next three events on the Google calendar will appear on the next page. I use this PHP (http://james.cridland.net/code/google-calendar.html) to access my XML feed and format it in HTML.
The problem I am facing is that for some reason a new day starts at 11 in the morning. For example, if there is an event in the Google calendar from 10:00 on December 20 that lasts an hour, my PHP output will show an event that starts at 10:00 on the 20th, which ends at 11:00 on the 21st. Otherwise, it works fine.
I set the time to local (New Zealand) time on my Google Calendar account and on PHP using date_default_timezone_set("Pacific/Auckland");
A terrible string that calculates the end date,
$gCalDateEnd = date($dateformat, strtotime($ns_gd->when->attributes()->endTime)+date("Z",strtotime($ns_gd->when->attributes()->endTime)));
where $ dateformat is a string with a date format.
Google XML Calendar gives start and end times
2011-12-22T10:00:00.000+13:00 2011-12-23T11:00:00.000+13:00
respectively, and PHP calculates the time frame from 10:00 a.m. December 22, 2011 to 14:00 on December 23, 2011.
What's happening?!?!
source share