Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Event Calendar - Google .ics import - Time Issues


11 Posts   8065 Views


10 December 2010 at 7:19am Community Member, 98 Posts

To import an .ics, follow [url=] this link [/url] and read Uncle Cheese's post about ICS Feeds.


1 February 2011 at 3:12am Community Member, 8 Posts

I've had the same problem with timezones when importing a google ics. I tried coffeymachine's function which worked to some extent but meant that times were always shown even if the event was a full or multi-day event so I decided to write my own little hack by reformatting the original string.

I also came across a second issue. Google marks a full day event by an end date of the next day which in effect was causing my dates to show a day extra.

+ checks to see if the date is full/multiday and adjusts the end time by one day.
+ adds ability to offset timezone for events with times associated.

In event_calendar/code/CalendarUtil.php line 153 add the extra code to the function date_info_from_ics:

    public static function date_info_from_ics($dtstart, $dtend)
      $start_date = null;
      $end_date = null;
      $start_time = null;
      $end_time = null;
      /* Google Calendar ICS date hacks for timezone settings and full day events */

      $fulldaytest = explode("T",$dtstart);
         $dtend = date('Ymd', strtotime($dtend.'-24 hours'));   
      else {
         $myOffset = '+9 hours'; // manual offset for Korea
         $startTimestamp = strtotime($dtstart.$myOffset);
         $dtstart = date('Ymd', $startTimestamp)."T".date('His', $startTimestamp)."Z";
         $endTimestamp = strtotime($dtend.$myOffset);
         $dtend = date('Ymd', $endTimestamp)."T".date('His', $endTimestamp)."Z";
      /* END Google ICS hack */
      ..... rest is the same as original function

Not too pretty but it'll do the job for now and I have not tested this thoroughly - so use at your own risk.

Hope this helps anyone else out there or at least puts you on the right track.



12 May 2011 at 12:46am Community Member, 13 Posts

Can't import any kind of ics into the calendar... It causes the page to go to error 500.