I have a script that is meant to synchronize event listings from a database (primary scheduling application for my clubs resources) into google calendar for remote viewing.

This is the best way for me to get the information out there. The problem that I am having is that I am creating events for the hourly booking, but the summary event I am trying to create is an "All day" event. However, after the php script inserts that event, the last hourly event of the day disapears from monthly view, and the all day event shows up.

Both show in agenda view, the all day doesn't show in "day" view.

When I try to manually edit the event it doesn't let me because it is complaining that the event end day is wrong (it appears correct, but isn't and if i change it to another day and then back, everything works ok)

code is:

$sDate = date("Y-m-d", $strTime);
                        $eDate = date("Y-m-d", $strTime);
                        createEvent($eventTitle, $syncId, $sDate, $eDate);

calling:

           
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00"; $when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00"; $event->when = array($when); $newEvent = $calendar->insertEvent($event, $calId);

Anyone have any experience with this?

    10 days later

    Solved the problem: When using the zend framework (or anything really) to add all day events to the google calendar, you need to set your ending date at 1 day past when it really ends.

      I guess that would be because if something starts at midnight 2008-05-16 and runs all day then it ends at midnight 2008-05-17.

        Actually, the way it ends up going into the google database it runs from 2008-05-16 00:00:00.0000 -> 2008-05-16 23:59:59.9999

        I guess it turns out start date/times are inclusive and end date/times are exclusive. What I was doing was setting them to the same date/time because that is what you would normally do when creating an event with the google calendar interface, but what you really need to be doing is setting start date = 2008-05-16 00:00:00.0000 and setting the end date to 2008-05-17 00:00:00.0000 and then it takes care of the rest.

        I mean, essentially what you said, but it doesn't present itself like that in the documentation which unless I'm looking at the wrong stuff isn't very thorough on the topic.

          If you're setting an all-day event in Google Calendar then you don't specify a time. (Ah, but note that, say, 23:59:59 is earlier than 23:59:59.9999). If you set the end time as being the same as the start time then how does that get interpreted as a full day (it looks like a zero-length instant)?

          But what you describe is the typical way of defining continuous intervals, both time and numeric (indeed, it's part of how real numbers are defined). Since 2008-05-16 00:03:00 is a second long, how can it refer to a particular instant at which something happens (instead of during)?

          The conventional answer is that it refers to the start of that second. So 2008-06-16 starts at 2008-06-16 00:00:00 and ends at 2008-06-17 00:00:00. Same way that something that runs all through January ends at the moment February starts.

            3 months later

            Hi all,
            I'm kind of new to this and I have a similar or same problem that in Google Calendar I have a two-day all day event (from 4th to 5th for ex.) and on my website using Zend to extract it, it is showing a 3 day event. Hourly events work fine.

            I understood the problem described but I can not seem to fix it. Could someone post some example code showing correct all day events from google calendar?

              Write a Reply...