我需要一些帮助来理解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
修改
谷歌生成的完整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
谷歌分别创建了所有5个事件。为什么。??
活动从4月至7月开始
是否有任何在Java中执行此操作的程序包,节省了大量时间
答案 0 :(得分:1)
您显示的信息是时区信息(请注意BEGIN:VTIMEZONE
和END:TIMEZONE
),并涵盖该时区的夏令时开始时间。具体而言,夏令时从每年第三个月的第二个星期日开始。
尝试查看BEGIN:VEVENT
和END:VEVENT
之间的代码段,您应该看到RRULE
的事件。
RRULE
的生成非常依赖于您的基础数据结构。 Google has a project,提供RRULE
的解析和评估。