Template:yearssince

From Homestar Runner Wiki

(Difference between revisions)
Jump to: navigation, search
(example of second format)
(use new cat)
 
(includes 7 intermediate revisions)
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 after 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:''' <code><nowiki>{{yearssince| some date }}</nowiki></code>
+
===='''Usage'''====
-
*'''Examples:'''
+
*<code><nowiki>{{yearssince| some date }}</nowiki></code>
-
**<code><nowiki>{{yearssince| 25 Aug 2003}}</nowiki></code>: {{yearssince| 25 Aug 2003}}
+
*<code><nowiki>{{yearssince| d=day | m=month | y=year }}</nowiki></code>
-
**<code><nowiki>{{yearssince| January 1, 2000}}</nowiki></code>: {{yearssince| January 1, 2000}}
+
 
-
**<code><nowiki>{{yearssince| 10/25/76}}</nowiki></code>: {{yearssince| 10/25/76}}
+
===='''Examples'''====
-
**<code><nowiki>{{yearssince| July 1983}}</nowiki></code>: {{yearssince| July 1983}}
+
{| border=1 cellspacing=0 cellpadding=5 style="border-collapse:collapse"
-
**<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| 15 Nov 2004 }}</nowiki></code> || {{yearssince| 15 Nov 2004 }}
 +
|-
 +
| <code><nowiki>{{yearssince| January 1, 2000 }}</nowiki></code> || {{yearssince| January 1, 2000 }}
 +
|-
 +
| <code><nowiki>{{yearssince| 10/25/76 }}</nowiki></code> || {{yearssince| 10/25/76 }}
 +
|-
 +
| <code><nowiki>{{yearssince| July 1983 }}</nowiki></code> || {{yearssince| July 1983 }}
 +
|-
 +
| <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 }}
 +
|}
 +
 
 +
[[Category:Date and Time Formatting Templates|{{PAGENAME}}]]
</noinclude>
</noinclude>

Current revision as of 17:34, 25 November 2017

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.

[edit] Usage

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

[edit] Examples

{{yearssince| 15 Nov 2004 }} 19
{{yearssince| January 1, 2000 }} 24
{{yearssince| 10/25/76 }} 47
{{yearssince| July 1983 }} 40
{{yearssince| d=29 | m=5 | y=1952 }} 71
{{yearssince| y=1995 }} 29
{{yearssince| y=1215 }} 809
Personal tools