简体   繁体   English

如何在Google日历中创建计数器

[英]How do I create a counter in google Calendar

How do I create a google calendar with a weekly (or daily) or any counter. 如何创建带有每周(或每天)或任何计数器的Google日历。 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. 我希望能够说从一个给定的日期开始,并算上我10个星期。 or start on a given date and count for me Y days. 或从给定的日期开始,算上我Y天。

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. 我不想导入Google日历计数器,因为它是从1月1日开始的,所以我想在各个随机点启动它。 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. 您可以使用Calendar API的Recurring Event Recurring event is a template for a series of events that usually happen with some regularity, for example daily or weekly. 周期性事件是一系列通常以一定规律性发生的事件的template ,例如每天或每周。

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. 然后,Google日历会将事件“扩展”为指定的事件。 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. 若要为重复事件创建例外,客户端应用程序首先需要检索需要设置为例外的重复事件的实例,并通过将授权的PUT请求发送到带有主体中更新的实例数据的实例编辑URL来更新此实例。 The URL is of the form: URL的格式为:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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