Designs | Resume | | email: ayubx003 (

« Alright, I Bit the Bullet [Ouch] | Main | New Design: Homecoming 2008 [UMN] »

Customize Google Calendar RSS Feeds: Sort Events, Limit Results, etc. [Tips & Tricks] | Posted at 2:21 PM

If you use an RSS reader to subscribe to people’s Google Calendar events, or you use an RSS parser to read your calendar’s feed onto a webpage, you may have realized that there’s not really any good documentation about customizing that feed. Well, actually, there IS but it’s not apparent from doing a simple Google search that you can use the Google Calendar API reference to see how to customize a feed display.

Today I wanted to do a couple things, I wanted to sort the RSS by start date and from the event happening soonest to the event happening later. I also wanted to limit the results to 5 to reduce time for parsing.

Here’s how to do it, it’s quite simple:[account]/public/basic?orderby=starttime&sortorder=ascending&max-results=5

If you notice, all I did was add some query string values.

orderby: starttime – Order results by when they start
sortorder: ascending – Order from least to greatest (soonest to latest)
max-results: 5 – Limit results to 5 events

You can use the following query string keys to customize your RSS data: Google Calendar API Reference

Tip: If you’re using PHP and SimplePie to parse the RSS, you need to add the following line of code to prevent SimplePie from automatically sorting the items by date:

Filed Under: How To Tips and Tricks


Thank you very much, you saved me from pulling out my hair.

I'm using SimplePie to display a Google calendar RSS feed. All is well except the time is set to GMT, and I need it to be local. I'm not a programmer, so a basic explanation would by much appreciated...

What if for some reason your feed doesn't have a xml tag. Has that happened to you?

I meant: "What if for some reason your feed doesn't have a gd:when xml tag?"


You are the man! Thank you for posting this.

Is there a way to list "the next 5 events in order of start time, STARTING FROM TODAY"?

e.g. something suitable for putting on a RSS feed on My Yahoo or something -- i.e. upcoming events.

Yes... that is what I show you how to do above. Doesn't that work?

Very useful. Thanks! Looking at the reference link that you provided, I also like adding singleevents=true, which expands recurring events into multiple individual ones


I'm wondering where I should place this code: $feed->enable_order_by_date(false);

It doesn't appear to be working if I nest it inside of the code you provided above. Any help would be greatly appreciated!

@Matt, do you use SimplePie? if you do then it should work by adding it anywhere but preferably at the top of the script before the parsing. However, if you don't use SimplePie then you dont have to worry about that part.

i use and found this INCREDIBLY useful.

i do have a question however, is there a way to get it to not show events that have passed? (ie: start with any event that occurs from today onward)

hey kids! i nailed it. i answered my own question and figured i'd share it with you.

if you only want to show future events, well you add:


that simple.

Hi. I'm displaying the Google Calendar RSS feed through the SimplyRSS plugin code on a Wordpress website. It will only display the date "1970/01/01" and not the event date. I understand that's some sort of default date, but I'm not sure why it's not working. Any thoughts would be much appreciated.

Additional Info: The events are displaying properly otherwise, and they are sorting properly from soonest to latest. Thanks!

Thanks so much for posting this. Really helpful!

Awesome! This is what I have been trying to do for a few days now. Thanks!

hi, thanks for your informations. but i would like to filter the feed. i would like to show only the daily events. how can i do it? thanks

I have a problem with my feed. i check the whol code and nothing. If any body help me... :(

I have multiple calendars on my google calendar. Any ideas on how to display this on one feed? Any help would be appreciated!

To merge google calendars using simplepie:

'rss feed url 1',
'rss feed url 2',
'rss feed url 3'

Otherwise you can use yahoo pipes to merge the 3 rss urls into 1.

thanks, u helped me sort things out...

ok, this is weird.

this feed gives me all future events:

but this feed only gives me the next event:

the only difference is the sortorder.

what gives?


now it works. maybe takes time for google rss servers to update.

new weirdness, firefox built-in reader reads the sort orders correctly. simplepie reads both feeds in descending order.

I use RSS alot, so this will help me for sure :)

I can't figure out how to customize the content of the feed. I only want the event title and date, but the feed gives me the location and an 'event status' as well. Any idea?

WHEW!!!!! Thank you! Thank you! Thank you! That was exactly what I needed to know.

This info was amazingly helpful! I was going to ask a dumb question, but decided to follow the link to the Google API. Awesome info! Thank you!!

This is very helpful. I have also noticed Google Calendar's rss includes a lot of unnecessary information. Feedburner at one point had an 'Event Feed' option which gave someone the privileges to edit the content of the feed, but it has since been deactivated. It seems as if this problem has been going on for a while. I would post your questions about the 'Event Status: Confirmed" here. That is a link to google calendars help forum.

Hi, Thank's for your example, it is fantastic, but I have a problem.
In my google calendar I have 56 events. In rss page I read only 25. Is it correct?

Thanks for that great information. I used google calendar but not utilizing it like you did.

Just the info I was looking for. I've fussed with so many wp widgets and just wasn't getting what I wanted, this will let me circumvent all that. Thanks for sharing man. Nice blog name/logo too by the way ;D

I have not used Google calender yet but i'm inspired to give this a go - thanks for the info.

Hi, Confused to buggery here. I put in the link as per above and yet my events are actually listing in the reader in the date and Time order I entered them into the callendar. Is their a substring I can add to force it to see the dates and times of the calendar and not the dreation date and time ?

Thank you! Thank you! Thank you! That was exactly what I needed to know.

When I type the rss feed address into internet explorer, it sorts by when the event was edited, not when the event takes place. I have tried adding the orderby=starttime&sortorder=ascending&max-results=5 but it still does not sort. Any ideas on how to fix this?

Also, I do not want to make my calendar public, and it does not give me an html address without making my calendar public.

I used this:

For my first calendar it worked (event did not have start and end time) For second calendar it only put next event (not today's event) even though the time of the event had not yet occurredIt worked for one calendar. Is there a time code or is there a way to say TODAY only and not just future events?

This shows Today's event only if it does not have a start and end time. Is there a time issue? Or can I choose just TODAY's events only regardless of time?

I am using Google calendar for organizing the events for my blog WordPressinas Word. However, we don't know about what are you describe here. So, thank you so much for creating a nice article. It helps me a lot of time.
Best Regards!

Hmmm... I was looking for some good online calendar that can be flexible enough to suit my taste.
I am pretty sure this guide would do me enough to get started with Google Calendar.
BTW, is this your primary blog on the interwebs? I would love to drop a link on my blog if it pleases you.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About the Author

Divide by Zero is Kamran Ayub's personal blog. Kamran owns and operates Intrepid Studios, a web design and development firm based in Minneapolis. Despite the above picture, Kamran is usually an intelligent person. Please forgive him.

View Kamran Ayub's profile on LinkedIn

Add to Technorati Favorites