Template:Diff days
| 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.
Syntax
{{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.333
Each date can include an era or a time, and a variety of formats are accepted. Examples of valid dates are:
- 1900-02-01
- 1900-2-1
- 1900-02-01 14:45
- 1 FEB 1900
- February 1, 1900
- February 1 1900 14:45
- 2:45 pm February 1 1900
- 1 February 1900 2:45 p.m.
- BC 1 Feb 120
{{diff days|2021-04-09 07:42:41|2021-10-17 04:35:44}}→ 190.870
If 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
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.