![]() | This is a documentation subpage for Template:Diff days. It may contain usage information, categories and other content that is not part of the original template page. |
![]() | This template uses Lua: |
This template calculates the date/time difference between two dates in days shown in decimal form. Dates in the Gregorian calendar from 9999 BCE to 9999 CE are supported. The calendar is proleptic—it is assumed to apply at all times with no irregularities.
((diff days|date1|date2|precision=))
There are two positional arguments: date1 and date2; both are required
The result displays text representing the time interval from date1 to date2 (date2 − date1) in decimal notation of |precision=
which defaults to 3; |precision=
accepts an integer from 0 to 99.
date1 and date2 are timezone agnostic when timezone not specified; date1 and date2 may have timezone specifiers:
((diff days|2022-03-16 12:00:00UTC|2022-03-16 12:00:00UTC))
→ 0.000((diff days|2022-03-16 12:00:00UTC|2022-03-16 12:00:00PST))
→ 0.333Each date can include an era or a time, and a variety of formats are accepted. Examples of valid dates are:
((diff days|2021-04-09 07:42:41|2021-10-17 04:35:44))
→ 190.870If the result is to include a specific no. of decimal places, add another parameter |precision=
which defaults to 3 and accepts any integer from 0 to 99:
((diff days|2021-04-09 07:42:41|2021-10-17 04:35:44|precision=5))
→ 190.87017