Difference between revisions of "Template:Date"

From Timelines
Jump to: navigation, search
(table)
(Moved sandbox live to fix wrong output when substituted)
 
(50 intermediate revisions by 9 users not shown)
Line 1: Line 1:
<includeonly>{{#ifeq:{{#time:Y-m-d|{{{1}}}}}|{{{1}}}|
+
{{{{{|safesubst:}}}#switch:none
{{#iferror:{{ #time:Y|{{{1}}} }}
+
|{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#time:Y_M_d|{{{1|}}} }} | none }} <noinclude><!-- #time: can't handle --></noinclude>
|{{{1|}}}
+
|{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#expr: {{{1|}}}+0 }}
|{{ #ifeq:{{#time:U|{{{1}}} }}|0
+
    |<noinclude><!--not a pure number--></noinclude>
  |{{{1|}}}
+
    |{{{{{|safesubst:}}}#ifexpr: {{{1|}}}+0 > 10000000000000
   |{{ #ifeq:{{{2| }}}|n
+
      |<noinclude><!-- a yyyymmddhhmmss timestamp --></noinclude>
  |{{ #ifeq:{{{3| }}}|mdy
+
      |{{{{{|safesubst:}}}#ifeq: {{{{{|safesubst:}}}#expr:{{{1|}}}+0}} | {{{1|}}}
    |{{ #time:F j, Y|{{{1}}} }}  
+
          | none <noinclude><!-- pure number eg 123.456 --></noinclude>
    |{{ #time:j F Y|{{{1}}} }} }}
+
          | <noinclude><!-- assume yy-mm-dd --></noinclude>
  |{{ #ifeq:{{{3| }}}|mdy
+
        }}
    |[[{{ #time:F j|{{{1}}} }}]], [[{{ #time:Y|{{{1}}} }}]]
+
    }}
     |[[{{ #time:j F|{{{1}}} }}]] [[{{ #time:Y|{{{1}}} }}]]}} }} }} }}<span style="display:none">(<span class="bday">{{{1}}}</span>)</span>
+
   }}
|{{{1}}}}}</includeonly><noinclude>
+
|{{{{{|safesubst:}}}#switch:  {{{{{|safesubst:}}}lc:{{{2|}}}}} | none | asis | link | lnone =none }}
 
+
|{{{{{|safesubst:}}}#ifexpr: {{{{{|safesubst:}}}#time:Y|{{{1|}}} }} < 1000 | none }}
==Usage==
+
|{{{{{|safesubst:}}}#switch:  {{{{{|safesubst:}}}#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
*Parameter 1 is the date given on [[ISO 8601]] formate ''YYYY-MM-DD'' ([[:meta:ParserFunctions#.23time:|#time]]). The template shows the date on the format ''D MMMM YYYY'' which is one of the [[de facto]] standards on english Wikipedia, see [[Wikipedia:MOS:DATE#Full_date_formatting]].
+
|= {{{{{|safesubst:}}}#if:{{{1|}}}
*Parameter 2 set it to n if the date should not be wikified.
+
      |{{{{{|safesubst:}}}#switch:{{{2}}}
 
+
        |link|lnone|l=[[{{{1}}}]]
{| class="wikitable" style="margin: 1em auto 1em auto"
+
        |{{{1}}}
|+ '''Cells left-aligned, table centered'''
+
      }}
! DMY || MDY
+
    }}<noinclude><!-- error or "none", so no formatting --></noinclude>
|-
+
|<noinclude><!-- continue with formatting --></noinclude>
| {{evd|ISOtodmymdy|2007-01-24}} || {{evd|ISOtodmymdy|2007-01-24|y|mdy}}
+
  {{{{{|safesubst:}}}#ifeq:<noinclude><!--
|-
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2008}}<noinclude><!--
| {{evd|ISOtodmymdy|2006-05-04|n}} || {{evd|ISOtodmymdy|2006-05-04|n|mdy}}
+
     --></noinclude>{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#ifexpr: {{{1}}}>10000000000000 | no }} | }}<noinclude><!--
|-
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2004}}
| {{evd|ISOtodmymdy|2006-5-4|n}} || {{evd|ISOtodmymdy|2006-5-4|n|mdy}}
+
  |20082004
|-
+
  |<noinclude><!-- no year --></noinclude>
| {{evd|ISOtodmymdy|2006-5-04|n}} || {{evd|ISOtodmymdy|2006-5-04|n|mdy}}
+
    {{{{{|safesubst:}}}#ifeq:{{{{{|safesubst:}}}#time:d|{{{1}}} 2036}}|{{{{{|safesubst:}}}#time:d|{{{1}}} }}
|-
+
    |<noinclude><!-- month+day --></noinclude>{{{{{|safesubst:}}}#time:
| {{evd|ISOtodmymdy|2006-05-4|n}} || {{evd|ISOtodmymdy|2006-05-4|n|mdy}}
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
|-
+
      | lmdy | liso | lymd      = [[:F j]]
| {{evd|ISOtodmymdy|May 4th, 2006|n}} || {{evd|ISOtodmymdy|May 4th, 2006|n|mdy}}  
+
      | mdy  | iso  | ymd      = F j
|}
+
      | ldmy | l                = [[:j F]]
 
+
      | #default                = j F
 
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy' or null or "" or unsupported option --></noinclude>
===Date strings #time function doesn't interpretes returns only the string ===
+
    |<noinclude><!-- month only --></noinclude>{{{{{|safesubst:}}}#time:
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
{{evd|ISOtodmymdy|23007-031-24}}
+
      | lmdy | liso | lymd
 
+
      | ldmy | l                = [[F]]
{{evd|ISOtodmymdy|1 December 2008}}
+
      | #default                = F
 
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt --></noinclude>
{{evd|ISOtodmymdy|[[1 December]] [[2008]]}}
+
    }}
 
+
  |<noinclude><!-- with year--></noinclude>
{{evd|ISOtodmymdy|1 December 2006}}
+
    {{{{{|safesubst:}}}#if: {{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2 {{{1|}}}}}|*D*|{{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2000 {{{1|}}}}}|*D*| }}}}
 
+
    |<noinclude><!-- day+month+year --></noinclude>{{{{{|safesubst:}}}#time:
{{evd|ISOtodmymdy|[[1 December]] [[2006]]}}
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 
+
      | lmdy                    = [[:F j]], [[Y]]
 
+
      | mdy                    = F j, Y
{{evd|ISOtodmymdy|24 June, 2006}} BUG
+
      | liso                    = [[Y|Y-]][[F j|m-d]]<noinclude><!-- i.e. [[Y-m-d]] --></noinclude>
 
+
      | iso                    = Y-m-d
{{evd|ISOtodmymdy|24 june 2006|n}} BUG
+
      | lymd                    = [[Y]] [[:F j]]
 
+
      | ymd                    = Y F j
;outside the [[:meta:ParserFunctions#.23time:|#time]] functions limits
+
      | ldmy | l                = [[:j F]] [[Y]]
 
+
      | #default                = j F Y
 
+
      }}|{{{1|}}} }}<noinclude><!-- #default='dmy' or null or "" or unsupported option --></noinclude>
{{evd|ISOtodmymdy|1901-12-13}}, <nowiki>{{#time:c|1901-12-13}}</nowiki> gives {{#time:c|1901-12-13}}
+
    |<noinclude><!-- month+year --></noinclude>{{{{{|safesubst:}}}#time:
 
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
{{evd|ISOtodmymdy|1901-12-14}}, <nowiki>{{#time:c|1901-12-14}}</nowiki> gives {{#time:c|1901-12-14}} (#time er riv ruskende gal, justert for i mal for alle disse tilfellene)
+
      | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
 
+
      | #default                = F Y
{{evd|ISOtodmymdy|1970-01-01}}, <nowiki>{{#time:c|1970-01-01}}</nowiki> gives {{#time:c|1970-01-01}}
+
      }}|{{{1|}}} }}<noinclude><!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option --></noinclude>
 
+
    }}
{{evd|ISOtodmymdy|1970-01-02}} (riktig, første dato innenfor), <nowiki>{{#time:c|1970-01-02}}</nowiki> gives {{#time:c|1970-01-02}}
+
  }}  
 
+
}}<noinclude>
{{evd|ISOtodmymdy|2038-01-19}} (riktig, siste dato innenfor), <nowiki>{{#time:c|2038-01-19}}</nowiki> gives {{#time:c|2038-01-19}}
+
{{documentation}}
 
 
{{evd|ISOtodmymdy|2038-01-20}}, <nowiki>{{#time:c|2038-01-20}}</nowiki> gives {{#time:c|2038-01-20}}
 
 
 
[[Category:Date-computing templates]]
 
[[Category:ISO date templates]]
 
 
 
[[no:Mal:ISOtilNorskdato]]
 
 
</noinclude>
 
</noinclude>

Latest revision as of 08:05, 12 September 2015

19 December 2024

Template documentation[create]