Template:yearssince

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(tweak)
(a year alone can be interpreted as a time; better to declare it explicitly)
Line 1: Line 1:
-
<includeonly>{{#ifexpr:{{CURRENTMONTH}}>{{{m|{{#time:n|{{{1|}}}}}}}} or ( {{CURRENTMONTH}}={{{m|{{#time:n|{{{1|}}}}}}}} and {{CURRENTDAY}}>={{{d|{{#time:j|{{{1|}}}}}}}} )|{{#expr: {{CURRENTYEAR}} - {{{y|{{#time:Y|{{{1|}}}}}}}} }}|{{#expr: ( {{CURRENTYEAR}} - 1 ) - {{{y|{{#time:Y|{{{1|}}}}}}}} }} }}</includeonly><noinclude>Outputs the number of whole years since a specified date. If the date is on or after 1 January 1970, it can be entered directly in a variety of formats. Otherwise, it must be specified using several parameters.
+
<includeonly>{{#ifexpr:{{CURRENTMONTH}}>{{{m|{{#time:n|{{{1|}}}}}}}} or ( {{CURRENTMONTH}}={{{m|{{#time:n|{{{1|}}}}}}}} and {{CURRENTDAY}}>={{{d|{{#time:j|{{{1|}}}}}}}} )|{{#expr: {{CURRENTYEAR}} - {{{y|{{#time:Y|{{{1|}}}}}}}} }}|{{#expr: ( {{CURRENTYEAR}} - 1 ) - {{{y|{{#time:Y|{{{1|}}}}}}}} }} }}</includeonly><noinclude>Outputs the number of whole years since a specified date. If the date is on or after 1 January 1970, it can be entered directly in a variety of formats. Otherwise, it must be specified using several parameters. '''If you specify only the year, it is recommended to declare it using the ''y'' parameter to avoid having it be interpreted as a time.'''
===='''Usage'''====
===='''Usage'''====
Line 15: Line 15:
|-
|-
| <code><nowiki>{{yearssince| July 1983 }}</nowiki></code> || {{yearssince| July 1983 }}
| <code><nowiki>{{yearssince| July 1983 }}</nowiki></code> || {{yearssince| July 1983 }}
-
|-
 
-
| <code><nowiki>{{yearssince| 1995 }}</nowiki></code> || {{yearssince| 1995 }}
 
|-
|-
| <code><nowiki>{{yearssince| d=29 | m=5 | y=1952 }}</nowiki></code> || {{yearssince| d=29 | m=5 | y=1952 }}
| <code><nowiki>{{yearssince| d=29 | m=5 | y=1952 }}</nowiki></code> || {{yearssince| d=29 | m=5 | y=1952 }}
 +
|-
 +
| <code><nowiki>{{yearssince| y=1995 }}</nowiki></code> || {{yearssince| y=1995 }}
|-
|-
| <code><nowiki>{{yearssince| y=1215 }}</nowiki></code> || {{yearssince| y=1215 }}
| <code><nowiki>{{yearssince| y=1215 }}</nowiki></code> || {{yearssince| y=1215 }}

Revision as of 05:43, 20 May 2009

Outputs the number of whole years since a specified date. If the date is on or after 1 January 1970, it can be entered directly in a variety of formats. Otherwise, it must be specified using several parameters. If you specify only the year, it is recommended to declare it using the y parameter to avoid having it be interpreted as a time.

Usage

  • {{yearssince| some date }}
  • {{yearssince| d=day | m=month | y=year }}

Examples

{{yearssince| 15 Nov 2004 }} 20
{{yearssince| January 1, 2000 }} 25
{{yearssince| 10/25/76 }} 48
{{yearssince| July 1983 }} 42
{{yearssince| d=29 | m=5 | y=1952 }} 73
{{yearssince| y=1995 }} 30
{{yearssince| y=1215 }} 810


Personal tools