Marriage
The duration is decomposed into whole calendar years, months, and remaining days. Total days use UTC calendar-day values to avoid daylight-saving shifts.
Formula
duration = calendar years + calendar months + remaining days
total days = (check date − wedding date) ÷ 86,400,000 ms
Why calendars and day counts disagree
A duration expressed in years, months and days depends on where the months fall, because months differ in length. Counting total days and then dividing gives a different answer from counting calendar months, and both are legitimate for different purposes. Anniversaries and milestone gifts usually follow the calendar version, while a rental term or contract period may be defined in days.
Time zones and leap years
Because dates are treated as UTC calendar days, the result is not shifted by daylight-saving changes, which can otherwise move a duration by an hour and occasionally by a day. Leap years are counted automatically, so a period spanning 29 February gains a day. For a duration between two specific moments rather than two dates, include the times of day, since an evening wedding and a morning signature on the same date otherwise look identical.
Marriage
时长拆分为完整日历年、月和剩余天数;总天数基于 UTC 日历日计算,避免夏令时造成偏差。
计算公式
时长 = 日历年 + 日历月 + 剩余天数
总天数 =(查询日期 − 婚礼日期)÷ 86,400,000 毫秒
为什么日历与天数不一致
用年、月、日表示的时长取决于月份落在哪里,因为各月天数不同。先算总天数再换算,与按日历月计算会得到不同结果,二者对不同用途都成立。周年纪念与里程碑礼物通常按日历年计算,而租期或合同期间可能以天数定义。
时区与闰年
由于日期按 UTC 日历日处理,结果不会受夏令时影响——否则时长可能差一小时甚至一天。闰年自动计入,因此跨越 2 月 29 日的区间会多一天。若需要的是两个具体时刻之间的时长而非两个日期之间,请把时刻一并纳入,否则同一天的晚间与上午会被视为相同。