gpt4 book ai didi

java - 使用 google-rfc-2445 createDateTimeIterator 生成日期范围时排除结束日期(UNTIL)

转载 作者:行者123 更新时间:2023-12-01 17:29:08 24 4
gpt4 key购买 nike

我需要知道如何避免 UNTIL 或结束日期被排除在此创建的日期范围内 - https://stackoverflow.com/a/27628608/5311573

请帮忙。

我试图使用上面链接中给出的答案来获取日期范围,但它每次都排除结束日期。

StartDate = 2020-04-21T00:00:00.000+05:30;
RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20200428

它将返回以下结果:

2020-04-20T18:30:00.000Z
2020-04-21T18:30:00.000Z
2020-04-22T18:30:00.000Z
2020-04-23T18:30:00.000Z
2020-04-24T18:30:00.000Z
2020-04-25T18:30:00.000Z
2020-04-26T18:30:00.000Z
2020-04-27T18:30:00.000Z

最佳答案

您的开始日期和时间似乎是2020-04-20T18:30:00.000Z尽管你上面有伪代码。因为这就是您列出的结果:18.30 重复。

如果每天重复一次,2020-04-28T18:30:00.000Z 将在 2020-04-20T00:00:000Z 之后。

因此,请使开始日期或日期时间与结束日期或日期时间一致。来自 https://icalendar.org/iCalendar-RFC-5545/3-3-10-recurrence-rule.html ,它说:

The UNTIL rule part defines a DATE or DATE-TIME value that bounds the recurrence rule in an inclusive manner. If the value specified by UNTIL is synchronized with the specified recurrence, this DATE or DATE-TIME becomes the last instance of the recurrence. The value of the UNTIL rule part MUST have the same value type as the "DTSTART" property. Furthermore, if the "DTSTART" property is specified as a date with local time, then the UNTIL rule part MUST also be specified as a date with local time. If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.

如果需要 UTC 时间,请将 UNTIL 更改为 2020-04-28T18:30:00.000Z 或2020-04-28T18:30:00.000(如果打算 float 时间)。
基本上 DTSTART 和 UNTIL 必须匹配。

关于java - 使用 google-rfc-2445 createDateTimeIterator 生成日期范围时排除结束日期(UNTIL),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61157610/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com