简体   繁体   中英

How do I create a counter in google Calendar

How do I create a google calendar with a weekly (or daily) or any counter. I can't seem to find clear code. I want to be able to say start on a given date and count for me 10 weeks. or start on a given date and count for me Y days.

I don't want to import a google calendar counter because that starts with January 1, I want to start it at various random points. Where and how do I code this?

Where/How does this code go? Is there a way to open a calendar event as though we are creating it manually and just put a line of code in there and it will calculate from there?

Thank you

You can use the Recurring Event of Calendar API. Recurring event is a template for a series of events that usually happen with some regularity, for example daily or weekly.

To create a recurring event, the client specifies the first instance of the event and includes one or more rules that describe when future events should occur. Google Calendar will then 'expand' the event into the specified occurrences. Individual events in a series may be changed, or even deleted. Such events become exceptions: they are still part of the series, but changes are preserved even if the recurring event itself is updated.

Here's a sample of recurring event that will occur every weekday of the current week:

POST https://www.googleapis.com/calendar/v3/calendars/primary/events

{
"summary": "Daily project sync",
"start": {
"dateTime": "2011-12-12T10:00:00",
"timeZone": "Europe/Zurich"
},
"end": {
"dateTime": "2011-12-12T10:15:00",
"timeZone": "Europe/Zurich"
},
"recurrence": [
"RRULE:FREQ=DAILY;COUNT=5"
]
}

To create exceptions to recurring events, client applications first need to retrieve the instance of the recurring event that needs to be set as an exception and update this instance by sending an authorized PUT request to the instance edit URL with updated instance data in the body. The URL is of the form:

https://www.googleapis.com/calendar/v3/calendars/calendarId/events/instanceId

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM