Reputation: 468
I am using Google API v3 for retrieving the holiday lists, here is how I use the API: https://www.googleapis.com/calendar/v3/calendars/en.usa%23holiday%40group.v.calendar.google.com/events?key=myAPIKey
It returns a list of holidays of its own way (some of them are 2021 and some of them are 2022), but I want to get a list of holidays of my own specific year. Like I pass the year 2021, then it will return all the holidays of 2021, similarly, if I pass 2022, then it will return 2022. But I have no idea how to pass a year parameter, or I have no idea whether Google Calendar allows passing such parameter for holidays.
Can anyone please help me?
Upvotes: 0
Views: 1900
Reputation: 679
According to the Google API Docs https://developers.google.com/calendar/api/v3/reference
There is a timeMax
and timeMin
url param that accepts a date/time range:
Must be an RFC3339 timestamp with mandatory time zone offset, for example, 2011-06-03T10:00:00-07:00, 2011-06-03T10:00:00Z. Milliseconds may be provided but are ignored. If timeMin is set, timeMax must be greater than timeMin.
https://www.googleapis.com/calendar/v3/calendars/primary/events?q=timeMax=2021-06-03T10%3A00%3A00-07%3A00&timeMin=2011-06-03T10%3A00%3A00-07%3A00
Note: The :
are url encoded to: %3A
Upvotes: 4