Date differences
Package:
DATETIME_PACKAGE. Registered bycreateEngine(); for a slimmer engine, register it explicitly (see choosing packages).
A date difference measures the span between two dates, in whichever unit you
ask for, or the time until or since a single date reckoned from now. The
between of two fixed dates is proven here; a duration to or from now moves
with the day.
A between of two fixed dates is proven; a duration to or from now moves with
the day.
weeks between 01/01/2024 and 01/06/2024 // 21.71 weeksdays until 25/12/2026days since 01/01/2023Counting a weekday
Section titled “Counting a weekday”fridays between two dates counts how many Fridays fall in the range, which is
a different question from how many weeks it spans. Every weekday name works, in
the plural a person counting would write or in the singular, and a leading how many reads the same.
fridays between 01/06/2026 and 31/08/2026 // 13how many fridays between 01/06/2026 and 31/08/2026 // 13mondays between 01/06/2026 and 31/08/2026 // 14weeks between 01/06/2026 and 31/08/2026 // 13 weeksThose three ranges are the same three months. It holds fourteen Mondays and
thirteen of everything else, because 1 June 2026 and 31 August 2026 are both
Mondays, which is the part weeks between cannot tell you: it answers thirteen
whichever weekday you meant.
until and since count against today rather than a second date.
mondays until 25/12/2026sundays since 01/01/2026Both ends are included
Section titled “Both ends are included”A range written to a Friday was written to include it, so a Friday on either
endpoint is counted. It follows that a single day counts as one if it is that
weekday and none if it is not, and that fridays until a Friday counts today.
It counts calendar weekdays and does not consult a holiday calendar, because a
Friday that is a public holiday is still a Friday. working days between is the
form that skips holidays, and it already exists: see
working days.