2014-03-19 43 views
1

我需要一些幫助來理解ICAL重複生成規則。ICAL重複規則生成(RRULE)

我已經創建了一個只有一個事件的日曆。該事件有一個規則在接下來的5天內每兩天重新發生。

谷歌日曆與此生成一個ICS文件。

... 
BEGIN:VTIMEZONE 
TZID:America/New_York 
X-LIC-LOCATION:America/New_York 
BEGIN:DAYLIGHT 
TZOFFSETFROM:-0500 
TZOFFSETTO:-0400 
TZNAME:EDT 
DTSTART:19700308T020000 
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU 
END:DAYLIGHT 
BEGIN:STANDARD 
TZOFFSETFROM:-0400 
TZOFFSETTO:-0500 
TZNAME:EST 
DTSTART:19701101T020000 
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU 
END:STANDARD 
END:VTIMEZONE 
... 

這是讓我困惑的部分。

RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU 

編輯

由谷歌產生全ICS文件。

BEGIN:VCALENDAR 
PRODID:-//Google Inc//Google Calendar 70.9054//EN 
VERSION:2.0 
CALSCALE:GREGORIAN 
METHOD:PUBLISH 
X-WR-CALNAME:Public 
X-WR-TIMEZONE:America/New_York 
X-WR-CALDESC:dsdadsa 
BEGIN:VTIMEZONE 
TZID:America/New_York 
X-LIC-LOCATION:America/New_York 
BEGIN:DAYLIGHT 
TZOFFSETFROM:-0500 
TZOFFSETTO:-0400 
TZNAME:EDT 
DTSTART:19700308T020000 
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU 
END:DAYLIGHT 
BEGIN:STANDARD 
TZOFFSETFROM:-0400 
TZOFFSETTO:-0500 
TZNAME:EST 
DTSTART:19701101T020000 
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU 
END:STANDARD 
END:VTIMEZONE 
BEGIN:VEVENT 
DTSTART;VALUE=DATE:20140415 
DTEND;VALUE=DATE:20140416 
DTSTAMP:20140319T053224Z 
UID:[email protected] 
RECURRENCE-ID;VALUE=DATE:20140415 
CLASS:PUBLIC 
CREATED:20140319T053209Z 
DESCRIPTION: 
LAST-MODIFIED:20140319T053209Z 
LOCATION: 
SEQUENCE:0 
STATUS:CONFIRMED 
SUMMARY:event details 
TRANSP:TRANSPARENT 
END:VEVENT 
BEGIN:VEVENT 
DTSTART;VALUE=DATE:20140413 
DTEND;VALUE=DATE:20140414 
DTSTAMP:20140319T053224Z 
UID:[email protected] 
RECURRENCE-ID;VALUE=DATE:20140413 
CLASS:PUBLIC 
CREATED:20140319T053209Z 
DESCRIPTION: 
LAST-MODIFIED:20140319T053209Z 
LOCATION: 
SEQUENCE:0 
STATUS:CONFIRMED 
SUMMARY:event details 
TRANSP:TRANSPARENT 
END:VEVENT 
BEGIN:VEVENT 
DTSTART;VALUE=DATE:20140411 
DTEND;VALUE=DATE:20140412 
DTSTAMP:20140319T053224Z 
UID:[email protected] 
RECURRENCE-ID;VALUE=DATE:20140411 
CLASS:PUBLIC 
CREATED:20140319T053209Z 
DESCRIPTION: 
LAST-MODIFIED:20140319T053209Z 
LOCATION: 
SEQUENCE:0 
STATUS:CONFIRMED 
SUMMARY:event details 
TRANSP:TRANSPARENT 
END:VEVENT 
BEGIN:VEVENT 
DTSTART;VALUE=DATE:20140409 
DTEND;VALUE=DATE:20140410 
DTSTAMP:20140319T053224Z 
UID:[email protected] 
RECURRENCE-ID;VALUE=DATE:20140409 
CLASS:PUBLIC 
CREATED:20140319T053209Z 
DESCRIPTION: 
LAST-MODIFIED:20140319T053209Z 
LOCATION: 
SEQUENCE:0 
STATUS:CONFIRMED 
SUMMARY:event details 
TRANSP:TRANSPARENT 
END:VEVENT 
BEGIN:VEVENT 
DTSTART;VALUE=DATE:20140407 
DTEND;VALUE=DATE:20140408 
DTSTAMP:20140319T053224Z 
UID:[email protected] 
RECURRENCE-ID;VALUE=DATE:20140407 
CLASS:PUBLIC 
CREATED:20140319T053209Z 
DESCRIPTION: 
LAST-MODIFIED:20140319T053209Z 
LOCATION: 
SEQUENCE:0 
STATUS:CONFIRMED 
SUMMARY:event details 
TRANSP:TRANSPARENT 
END:VEVENT 
END:VCALENDAR 

而不是給創建的所有5個事件分別此

RRULE:FREQ=DAILY;COUNT=5;INTERVAL=2 

谷歌。爲什麼。??從四月-7-2014

事件開始是否有任何包在Java中這樣做,節省了我大量的時間

回答

1

你已經顯示的信息時區信息(注BEGIN:VTIMEZONEEND:TIMEZONE),並涵蓋該時區夏令時的開始時間。具體來說,夏令時從每年的第三個月的第二個星期日開始。

試着看一下BEGIN:VEVENTEND:VEVENT之間的代碼段,你應該在這裏看到你的事件的RRULE

代的RRULE s很依賴於您的基礎數據結構。 Google has a project它提供了對RRULE的解析和評估。

+0

謝謝,這是一個很好的解釋。 :)我認爲谷歌正在以不同的方式構建東西。 爲什麼谷歌建立單獨的VEVENT而不是創建像'RRULE:FREQ = DAILY; COUNT = 5; INTERVAL = 2'這樣的規則? – Dileep

+0

請您可以顯示完整的日曆,包括'VEVENT',以便我可以解釋? – jgm

+0

檢查編輯,我已經添加了所有的細節.. :) – Dileep