コンテンツにスキップ

Template:Time interval/doc

ここに概要や目的

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年, 2ヶ月 and 3日
  • {{time interval|1 Jan 2001|March 4, 2002|abbr=on}} → 1年 2ヶ月 3日
  • {{time interval|B.C.E. 1 Feb 120|28 FEB 1900}} → 2019年 and 27日

Parameters

[編集]
ParameterDescription
abbr=offUnit names in full (default): year, month, day, hour, minute.
abbr=onUnits shown as a single letter with no space between number and unit: y, m, d, h, m.
disp=ageIf 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=rawDisplay numbers only with sep=space.
duration=onPeriod is a duration (has an extra day to include the end date).
format=commasNumbers over 999 are formatted with commas.
format=rawUse 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=commaSeparator 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=serialcommaUse a serial comma: 1 year, 2 months, and 3 days.
sep=spaceUse a space: 1 year 2 months 3 days.
sc=yChange the default separator to use a serial comma. Also accepts sc=yes and sc=on.
show=yyears
show=ymyears and months
show=ymdyears, months and days (default)
show=ymwyears, months and weeks
show=ymwdyears, months, weeks and days
show=ydyears and days
show=mmonths
show=mdmonths and days
show=wweeks
show=wdweeks and days
show=ddays
show=dhdays and hours
show=dhmdays, hours and minutes
show=dhmsdays, hours, minutes and seconds
show=ymdhymd + hours
show=ymdhmymd + hours and minutes
show=ymwdhymwd + hours
show=ymwdhmymwd + hours and minutes
show=hhours (result would be 48 hours for a difference of 2 days)
show=hmhours and minutes
show=hmshours, minutes and seconds
round=onRound the least-significant unit specified with the show= parameter.
round=monthsRound to nearest month using show=ym.
round=weeksRound to nearest week using show=ymw.
round=daysRound to nearest day using show=ymd.
round=hoursRound to nearest hour using show=ymdh.
sortable=onOutput 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=offNo sort key (default).
sortable=debugOutput a visible sort key for testing.

関連項目

[編集]