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, Ed, biapar, Willr, Ingo, swaiba

Event Calendar - Google .ics import - Time Issues

Go to End

11 Posts   9724 Views


Community Member, 11 Posts

2 October 2009 at 5:16pm


I am having a problem importing my Google Calendar(.ics) into the Event Calendar Module and displaying the correct time. I am using SS2.3.3 with the latest trunk build of the event calendar module (r82). Below is an excerpt from my _config file:

Object::add_extension('LeftAndMain', 'CalendarScriptInit');
Calendar::set_param('timezone', 'US-Eastern');

Currently, the events that are showing up on the page imported by the Event Calendar module are off by 4hours. I have attempted to modify the offset which should be correct for EST but it seems to have no affect on the imported .ics file. Below are links to the public calendar I am attempting to import:



I also just noticed a few other problems:

Some events are not showing up at all
When filtering the events, it still displays events not within the specified time frame.
In the actual XML feed it appears that multiple timezones are being used such as EDT. I have reviewed the timezone in the google calendar settings and it is set correctly to Eastern Specific.

I appreciate any input on this issue and will provide any additional details as needed.



Forum Moderator, 4102 Posts

3 October 2009 at 2:02am

Edited: 03/10/2009 2:03am

This is unfortunately one of the neglected features of EventCalendar due to lack of testers, so thanks for taking the time to kick the tires a bit.

The events not being filtered properly was caused by a bug I had fixed, but realized I had never checked in. So if you update your SVN, you should get that fix.

I have your ICS running on the demo site here Can you tell me what I should be looking for? Which times are wrong? What events are missing? I'll do my best to help you out.


Community Member, 11 Posts

3 October 2009 at 3:57am

Hi Uncle Cheese,

Thank you for your time and assistance. I have been reading your previous post and appreciate the support you provide to the community.

I have compiled a quick & dirty image displaying which events are not being shown in the calendar (indicated in pink) and which events are displayed but with the incorrect time (indicated in blue). It appears the times are off by -4 hours. The majority of the events that are not displayed are repeat events. I included an example of the full event details for both cases. I believe I mentioned before that I noticed different timezones in the RSS feed, below is an excerpt:

Panthers v Tampa Ticket Giveaway
Thursday, October 01, 2009 11:50 PM
When: Sun Oct 18, 2009 1pm to 2:30pm EDT <---------------here

Where: Ruckus Cary
Event Status: confirmed
Mims NCSU / UNC promotion
Thursday, October 01, 2009 3:34 PM
When: Sat Dec 5, 2009 12:30pm to 2:30pm EST <--------------- here

I have been messing around with the calendar and can't quite figure out what is going on here. I look forward to hearing back from you and any help you can provide.


Attached Files

Forum Moderator, 4102 Posts

3 October 2009 at 6:37am

This certainly raises a lot of questions. First thing I see is that the ICS is coming in with the wrong times, so this may be a Google setting we don't know about. You'll notice the Uroz wine tasting comes in with the times 4 hours off:

UID:[email protected]
DESCRIPTION:Come Sample Some Great Wines And Buy At A Wholesale Price!!!
LOCATION:Ruckus Cary
SUMMARY:Uroz Wine Tasting

Second thing is that the events that aren't showing up are getting cut because their start dates are our of range.

Let's look at Smokin' Saturdays as an example:

UID:[email protected]
SUMMARY:Smokin' Saturdays

It comes in with a start/end date in September instead of tomorrow.

Also notice in your vCalendar header that there are two parameters for timezone:


That may have something to do with it.

I don't have any answers, but at least we know we can fix it from within the feed.


Community Member, 10 Posts

23 December 2009 at 12:50pm

The issue here is Google exports the time of all their events in UTC (GMT, Zulu, universal time, or whatever you want to call it) even though they specify the time zone in their .ics file. Don't ask me why.

The solution is to offset their time by your local time offset. In event_calendar/code/CalendarUtil.php line 153 replace the function date_info_from_ics with this code:

public static function date_info_from_ics($dtstart, $dtend)
		$myOffset = '+1 hours';
		$startTimestamp = strtotime($dtstart.$myOffset);
		$start_date = date('Y-m-d', $startTimestamp);
		$start_time = date('H:i:s', $startTimestamp);
		$endTimestamp = strtotime($dtend.$myOffset);
		$end_date = date('Y-m-d', $endTimestamp);
		$end_time = date('H:i:s', $endTimestamp);

		return array($start_date, $end_date, $start_time, $end_time);	

Now the time offset works a little funny, I have to set "+1 hours" as the $myOffset variable to get Eastern Standard Time (-5 hours). I haven't had the time to dig into why it works like this, but this is a quick and dirty solution to this problem.

This fix can definitely be improved. If we could get the time offset from the _config.php file that would be nice, or even use the time zone from Google's .ics file. I'll try to look into this if I get time. The big annoyance with this is that I am going to have to change the offset when daylight savings time comes around, and events visible on the calendar after a daylight savings time change will show the incorrect time.


Community Member, 10 Posts

24 December 2009 at 4:25am

Disregard the last paragraph I wrote if you are importing from Google Calendar. After a little testing this morning (my eyes were sore from staring at code last night) it turns out Google makes the DST shift for us in the .ics file. So if you are importing from Google my above solution will work just fine year-round.

If you are importing from some calendar other than Google you should test this.

I would still like to figure out how to get the time zone offset from _config.php.


Community Member, 10 Posts

30 January 2010 at 6:24pm

Edited: 30/01/2010 6:25pm

Is there any way to import events from a CSV file? I need to import events from a CSV file.
And also I need to import from ICS file instead of giving the url in CMS admin.


Community Member, 98 Posts

10 December 2010 at 5:38am

Edited: 10/12/2010 5:39am

Uncle Cheese,
I'm having the same problem with the date being 5 hours ahead - the date of the event should be 8 pm on Dec 8th, but it is showing as 1:00 am on Dec 9th. I've imported the .ics from our GroupWise Master Calendar, and it works beautifully, but for the time offset being wrong. I did check the offset in the _config.php, but the .ics data remains unaffected. I also tried the code that coffeymachine suggested but it threw errors.
I see there wasn't really a resolution other than that Google does compensate, but I'm not using Google. (I tried to attach the .ics file I'm using but got "server error".)

"I would still like to figure out how to get the time zone offset from _config.php." - is this possible to correct?

Thanks so much.

Go to Top