我需要一些帮助来理解ICAL递归规则的生成。
我创建了一个日历,其中只有一个事件。该事件有一个规则,在接下来的5天内每2天重新发生一次。
google日历生成一个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
编辑
由google生成的完整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:n8gccbdmtb3gdgml543auul5ng@google.com
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:n8gccbdmtb3gdgml543auul5ng@google.com
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:n8gccbdmtb3gdgml543auul5ng@google.com
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:n8gccbdmtb3gdgml543auul5ng@google.com
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:n8gccbdmtb3gdgml543auul5ng@google.com
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
不给这个
RRULE:FREQ=DAILY;COUNT=5;INTERVAL=2
google分别创建了这5个事件。为什么。? ?
活动从2014年4月7日开始
在Java中是否有这样做的包,节省了我很多时间
显示的信息是时区信息(注意BEGIN:VTIMEZONE
和END:TIMEZONE
),涵盖了该时区的夏令时开始时间。具体来说,夏令时从每年第三个月的第二个星期日开始。
尝试查看BEGIN:VEVENT
和END:VEVENT
之间的代码片段,您应该看到您的事件的RRULE
。
RRULE
s的生成非常依赖于底层数据结构。Google有一个项目提供RRULE
s的解析和评估。