Calendar days and elapsed hours
A date is a place on a calendar. An instant is a place on the timeline.
Count dates without a time zone
February 28 to March 1, 2024 is two calendar days. Calendar arithmetic does not divide local-midnight milliseconds by 86,400,000.
Measure elapsed time with instants
In New York on March 10, 2024, 01:30 to 03:30 covers one elapsed hour even though the clock labels span two hours.
Add months with a policy
January 31 plus one calendar month clamps to February’s last valid day. Subtracting a month afterward need not recover January 31. Use reject-overflow when clamping is unsuitable.
Published by TrueHour · Calculation rules, sources and limitations · Report a correction