Difference between revisions of "Template:Date"

From Timelines
Jump to: navigation, search
(restore {{doc}} and {{pp-template}})
(Moved sandbox live to fix wrong output when substituted)
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{#switch:none
+
{{{{{|safesubst:}}}#switch:none
  |{{#iferror: {{#time:Y_M_d|{{{1|}}} }}|none}}
+
  |{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#time:Y_M_d|{{{1|}}} }} | none }} <noinclude><!-- #time: can't handle --></noinclude>
  |{{#switch:{{lc:{{{2|}}}}}|none|asis=none}}
+
  |{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#expr: {{{1|}}}+0 }}
|{{#ifexpr: {{#time:Y|{{{1|}}} }} < 1582|none}}<!--
+
    |<noinclude><!--not a pure number--></noinclude>
--> = {{{1|}}}<!-- error or "none", so no formatting -->
+
    |{{{{{|safesubst:}}}#ifexpr: {{{1|}}}+0 > 10000000000000
|<!-- continue with formatting -->
+
      |<noinclude><!-- a yyyymmddhhmmss timestamp --></noinclude>
  {{#iferror: {{#expr:{{{1|dummy}}} }}
+
      |{{{{{|safesubst:}}}#ifeq: {{{{{|safesubst:}}}#expr:{{{1|}}}+0}} | {{{1|}}}
  |<!-- input is not just a solitary number -->
+
          | none <noinclude><!-- pure number eg 123.456 --></noinclude>
    {{#ifeq:{{#time:Y|{{{1|1 Jan 2000}}} 1996}}{{#time:Y|{{{1|1 Jan 2000}}} 2004}}|19962004
+
          | <noinclude><!-- assume yy-mm-dd --></noinclude>
    |<!-- no year -->
+
        }}
      {{#ifeq:{{#time:d|{{{1|}}} 2036}}|{{#time:d|{{{1|}}} }}
+
    }}
      |<!-- month+day -->{{#time:
+
  }}
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
|{{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc:{{{2|}}}}} | none | asis | link | lnone =none }}
        | lmdy | liso | lymd      = [[:F j]]
+
|{{{{{|safesubst:}}}#ifexpr: {{{{{|safesubst:}}}#time:Y|{{{1|}}} }} < 1000 | none }}
        | mdy  | iso  | ymd      = F j
+
|{{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
        | ldmy | l               = [[:j F]]
+
|= {{{{{|safesubst:}}}#if:{{{1|}}}
        | #default                = j F
+
      |{{{{{|safesubst:}}}#switch:{{{2}}}
        }}|{{{1|}}} 2000 }}<!-- default='dmy' or null or "" or unsupported option -->
+
        |link|lnone|l=[[{{{1}}}]]
      |<!-- month only -->{{#time:
+
        |{{{1}}}
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
      }}
        | lmdy | liso | lymd
+
    }}<noinclude><!-- error or "none", so no formatting --></noinclude>
        | ldmy | l                = [[F]]
+
|<noinclude><!-- continue with formatting --></noinclude>
        | #default                = F
+
  {{{{{|safesubst:}}}#ifeq:<noinclude><!--
        }}|{{{1|}}} 2000 }}<!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt -->
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2008}}<noinclude><!--
      }}
+
    --></noinclude>{{{{{|safesubst:}}}#iferror: {{{{{|safesubst:}}}#ifexpr: {{{1}}}>10000000000000 | no }} | }}<noinclude><!--
    |<!-- with year-->
+
    --></noinclude>{{{{{|safesubst:}}}#time:Y|{{{1}}} 2004}}
      {{#if: {{#iferror:{{#time:j|2 {{{1|}}}}}|*D*|{{#iferror:{{#time:j|2000 {{{1|}}}}}|*D*| }}}}
+
  |20082004
      |<!-- day+month+year -->{{#time:
+
  |<noinclude><!-- no year --></noinclude>
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
    {{{{{|safesubst:}}}#ifeq:{{{{{|safesubst:}}}#time:d|{{{1}}} 2036}}|{{{{{|safesubst:}}}#time:d|{{{1}}} }}
        | lmdy                   = [[:F j]], [[Y]]
+
    |<noinclude><!-- month+day --></noinclude>{{{{{|safesubst:}}}#time:
        | mdy                     = F j, Y
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
        | liso                    = [[Y|Y-]][[F j|m-d]]<!-- i.e. [[Y-m-d]] -->
+
      | lmdy | liso | lymd      = [[:F j]]
        | iso                     = Y-m-d
+
      | mdy | iso | ymd       = F j
        | lymd                    = [[Y]] [[:F j]]
+
      | ldmy | l                = [[:j F]]
        | ymd                     = Y F j
+
      | #default                = j F
        | ldmy | l                = [[:j F]] [[Y]]
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy' or null or "" or unsupported option --></noinclude>
        | #default                = j F Y
+
    |<noinclude><!-- month only --></noinclude>{{{{{|safesubst:}}}#time:
        }}|{{{1|}}} }}<!-- #default='dmy' or null or "" or unsupported option -->
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
      |<!-- month+year -->{{#time:
+
      | lmdy | liso | lymd  
        {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
      | ldmy | l               = [[F]]
        | lmdy | liso | lymd | ldmy | l = [[:F Y]]
+
      | #default                = F
        | #default                = F Y
+
      }}|{{{1}}} 2000 }}<noinclude><!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsupported opt --></noinclude>
        }}|{{{1|}}} }}<!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option -->
 
      }}
 
 
     }}
 
     }}
   |<!-- input is a solitary number. Treat it as just a year. -->
+
   |<noinclude><!-- with year--></noinclude>
     {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
    {{{{{|safesubst:}}}#if: {{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2 {{{1|}}}}}|*D*|{{{{{|safesubst:}}}#iferror:{{{{{|safesubst:}}}#time:j|2000 {{{1|}}}}}|*D*| }}}}
    | lmdy | liso | lymd  
+
     |<noinclude><!-- day+month+year --></noinclude>{{{{{|safesubst:}}}#time:
    | ldmy | l                = [[{{#expr:{{{1|}}} }}]]
+
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
    | #default                = {{#expr:{{{1|}}} }}
+
      | lmdy                   = [[:F j]], [[Y]]
 +
      | mdy                    = F j, Y
 +
      | liso                   = [[Y|Y-]][[F j|m-d]]<noinclude><!-- i.e. [[Y-m-d]] --></noinclude>
 +
      | iso                    = Y-m-d
 +
      | lymd                   = [[Y]] [[:F j]]
 +
      | ymd                    = Y F j
 +
      | ldmy | l                = [[:j F]] [[Y]]
 +
      | #default                = j F Y
 +
      }}|{{{1|}}} }}<noinclude><!-- #default='dmy' or null or "" or unsupported option --></noinclude>
 +
    |<noinclude><!-- month+year --></noinclude>{{{{{|safesubst:}}}#time:
 +
      {{{{{|safesubst:}}}#switch: {{{{{|safesubst:}}}lc: {{{{{|safesubst:}}}#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
 +
      | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
 +
      | #default                = F Y
 +
      }}|{{{1|}}} }}<noinclude><!-- default='dmy'/'iso'/'mdy'/null/""/unsupported option --></noinclude>
 
     }}
 
     }}
 
   }}     
 
   }}     
 
}}<noinclude>
 
}}<noinclude>
{{pp-template|small=yes}}
 
 
{{documentation}}
 
{{documentation}}
 
</noinclude>
 
</noinclude>

Latest revision as of 08:05, 12 September 2015

18 December 2024

Template documentation[create]