15

How to get all events between two specific dates. For example i only want to get events between 1st of March 2013 & 28th of March 2013.

I am using Google Calendar API v3. While in Google Calendar API v1 there was the facility for search between 2 dates using start-min & start-max. I am wondering what is the replacement for these two parameters in Google Calendar API v3?

Khawer Zeshan
  • 9,470
  • 6
  • 40
  • 63

2 Answers2

26

Ok i got the answer. The new parameters in Google API V3 are timeMin & timeMax to filter events between 2 dates.

Khawer Zeshan
  • 9,470
  • 6
  • 40
  • 63
  • Glad you found the solution :) – talha2k Mar 20 '13 at 09:05
  • Hi, your answer may be very helpfull for me. How did you apply these parameters ? Did you use it in Javascript ? – Desnoxav May 06 '13 at 14:02
  • No i used it in Google PHP API. – Khawer Zeshan May 06 '13 at 19:31
  • 7
    Example for the PHP Client Libs: `$service->events->listEvents('primary', array('timeMin'->'2013-03-01T00:00:00-04:00', 'timeMax'->'2013-03-28T23:59:59-04:00'));` Note that the timestamps are in RFC 3339 format. All of the parameters can be found here: https://developers.google.com/google-apps/calendar/v3/reference/events/list – allicarn Aug 15 '13 at 18:58
  • You can see how the values are formatted here as well - http://stackoverflow.com/questions/13032011/get-list-of-the-day-events-from-google-calendar – klewis Oct 12 '15 at 18:15
0

Just add these two parameters to the query before getting the event feed:

// Start date from where to get the events
$query->setStartMin('2013-01-01');
// End date
$query->setStartMax('2013-03-20');

Hope this helps.

Umpa
  • 334
  • 11
  • 16
talha2k
  • 24,937
  • 4
  • 62
  • 81
  • i am using Google Calendar API v3. While in Google Calendar API v1 there was the facility for search between 2 dates using `start-min` & `start-max`. I am wondering what is the replacement for these two parameters in Google Calendar API v3. – Khawer Zeshan Mar 20 '13 at 07:17