සැකිල්ල:Time interval/ලේඛය
Appearance
මෙම සැකිල්ල ලුවා භාවිතා කරයි: |
This template calculates the date/time difference between two dates. 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
[සංස්කරණය]{{time interval|date1|date2|options}}
There are two positional arguments: date1 and date2. The default for each is the current date and time.
The result displays text representing the time interval from date1 to date2 (date2 − date1).
Dates are UTC—local times and time zones are not supported.
Dates are checked for validity. For example, 29 February 2000 is accepted, but 29 February 1900 is not a valid date.
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
Examples:
{{time interval|1 Jan 2001|March 4, 2002}}
→ 1 year, 2 months and 3 days{{time interval|1 Jan 2001|March 4, 2002|abbr=on}}
→ 1y 2m 3d{{time interval|B.C.E. 1 Feb 120|28 FEB 1900}}
→ 2019 years and 27 days
Parameters
[සංස්කරණය]Parameter | Description |
---|---|
abbr=off |
Unit names in full (default): year, month, day, hour, minute. |
abbr=on |
Units shown as a single letter with no space between number and unit: y, m, d, h, m. |
disp=age |
If no show has been entered, years are displayed if the age is above 3 years, years and months from 1 to 3 years, or months and days for under 1 year. Sets sep=space by default. This is compatible with {{age for infant}}.
|
disp=raw |
Display numbers only with sep=space .
|
duration=on |
Period is a duration (has an extra day to include the end date). |
format=commas |
Numbers over 999 are formatted with commas. |
format=raw |
Use a hyphen (-) to indicate a negative date difference instead of a minus (−); a hyphen may allow the result to be used in a calculation. |
sep=comma |
Separator between items is a comma: 1 year, 2 months, 3 days. The default is 1 year, 2 months and 3 days. |
sep=, |
Same as sep=comma .
|
sep=serialcomma |
Use a serial comma: 1 year, 2 months, and 3 days. |
sep=space |
Use a space: 1 year 2 months 3 days. |
sc=y |
Change the default separator to use a serial comma. Also accepts sc=yes and sc=on .
|
show=y |
years |
show=ym |
years and months |
show=ymd |
years, months and days (default) |
show=ymw |
years, months and weeks |
show=ymwd |
years, months, weeks and days |
show=yd |
years and days |
show=m |
months |
show=md |
months and days |
show=w |
weeks |
show=wd |
weeks and days |
show=d |
days |
show=dh |
days and hours |
show=dhm |
days, hours and minutes |
show=dhms |
days, hours, minutes and seconds |
show=ymdh |
ymd + hours |
show=ymdhm |
ymd + hours and minutes |
show=ymwdh |
ymwd + hours |
show=ymwdhm |
ymwd + hours and minutes |
show=h |
hours (result would be 48 hours for a difference of 2 days) |
show=hm |
hours and minutes |
show=hms |
hours, minutes and seconds |
round=on |
Round the least-significant unit specified with the show= parameter.
|
round=months |
Round to nearest month using show=ym .
|
round=weeks |
Round to nearest week using show=ymw .
|
round=days |
Round to nearest day using show=ymd .
|
round=hours |
Round to nearest hour using show=ymdh .
|
sortable=on |
Output a hidden sort key based on the number of days in the date difference (includes a fraction of a day to handle time differences). |
sortable=off |
No sort key (default). |
sortable=debug |
Output a visible sort key for testing. |