How can an anniversary on leap day stay in February the next year?

When a date shift creates an ambiguous day, the following floor modifier chooses the earlier valid date.

SQLite example and interpretation

Moving leap day 2024 forward one year gives February 28 under floor and March 1 under ceiling. Settle that convention when defining billing anniversaries.

SELECT date('2024-02-29','+1 year','floor'),date('2024-02-29','+1 year','ceiling');

Result [["2025-02-28", "2025-03-01"]]

中文

闰日加一年后,周年日按哪个月末计算?

日期平移产生不存在的日号时,紧随平移的 floor 修饰符选择较早的合法日期。

SQLite 示例与适用条件

2024 年 2 月 29 日平移一年,floor 取 2025 年 2 月 28 日,ceiling 取 3 月 1 日。订阅账期需明确是哪一种规则。

SELECT date('2024-02-29','+1 year','floor'),date('2024-02-29','+1 year','ceiling');

结果 [["2025-02-28", "2025-03-01"]]

References / 参考来源

Keep reading / 继续阅读