Difference between revisions of "Template:Date"

From its-wiki.no
Jump to: navigation, search
m (1 revision: XML file from Josef)
m (Created page with "<noinclude> This is the "Date" template. It should be called through <nowiki> {{date}} </nowiki> </noinclude><includeonly> <span style="float: right; font-size: 80%;" > {{REVISI...")
 
Line 1: Line 1:
{{#switch:none
+
<noinclude>
|{{#iferror: {{#time:Y_M_d|{{{1|}}} }} | none }} <!-- #time: can't handle -->
+
This is the "Date" template. It should be called through <nowiki> {{date}} </nowiki>
|{{#iferror: {{#expr: {{{1|}}}+0 }}
+
</noinclude><includeonly>  
    |<!--not a pure number-->
+
<span style="float: right; font-size: 80%;" > {{REVISIONMONTH}}.{{REVISIONYEAR}} </span>
    |{{#ifexpr: {{{1|}}}+0 > 10000000000000
+
</includeonly>
      |<!-- a yyyymmddhhmmss timestamp -->
+
      |{{#ifeq: {{#expr:{{{1|}}}+0}} | {{{1|}}}
+
          | none <!-- pure number eg 123.456 -->
+
          | <!-- assume yy-mm-dd -->
+
        }}
+
    }}
+
  }}
+
|{{#switch:  {{lc:{{{2|}}}}} | none | asis=none }}
+
|{{#ifexpr:  {{#time:Y|{{{1|}}} }} < 1000 | none }}
+
|{{#switch:  {{#time:Ynj|{{{1|}}} }}|100031|110031|130031|140031|150031=none}}
+
|= {{{1|}}}<!-- error or "none", so no formatting -->
+
|<!-- continue with formatting -->
+
  {{#ifeq:<!--
+
    -->{{#time:Y|{{{1}}} 2008}}<!--
+
    -->{{#iferror: {{#ifexpr: {{{1}}}>10000000000000 | no }} | }}<!--
+
    -->{{#time:Y|{{{1}}} 2004}}
+
  |20082004
+
  |<!-- no year -->
+
    {{#ifeq:{{#time:d|{{{1}}} 2036}}|{{#time:d|{{{1}}} }}
+
    |<!-- month+day -->{{#time:
+
      {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
      | lmdy | liso | lymd      = [[:F j]]
+
      | mdy  | iso  | ymd      = F j
+
      | ldmy | l                = [[:j F]]
+
      | #default                = j F
+
      }}|{{{1}}} 2000 }}<!-- default='dmy' or null or "" or unsuppplaceed option -->
+
    |<!-- month only -->{{#time:
+
      {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
      | lmdy | liso | lymd
+
      | ldmy | l                = [[F]]
+
      | #default                = F
+
      }}|{{{1}}} 2000 }}<!-- default='dmy'/'mdy'/'ymd'/'iso'/null/""/unsuppplaceed opt -->
+
    }}
+
  |<!-- with year-->
+
    {{#if: {{#iferror:{{#time:j|2 {{{1|}}}}}|*D*|{{#iferror:{{#time:j|2000 {{{1|}}}}}|*D*| }}}}
+
    |<!-- day+month+year -->{{#time:
+
      {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
      | lmdy                    = [[:F j]], [[Y]]
+
      | mdy                    = F j, Y
+
      | liso                    = [[Y|Y-]][[F j|m-d]]<!-- i.e. [[Y-m-d]] -->
+
      | iso                    = Y-m-d
+
      | lymd                    = [[Y]] [[:F j]]
+
      | ymd                    = Y F j
+
      | ldmy | l                = [[:j F]] [[Y]]
+
      | #default                = j F Y
+
      }}|{{{1|}}} }}<!-- #default='dmy' or null or "" or unsuppplaceed option -->
+
    |<!-- month+year -->{{#time:
+
      {{#switch: {{lc: {{#ifeq:{{{3|}}}|y|L}}{{{2|}}} }}
+
      | lmdy | liso | lymd | ldmy | l  = [[:F Y]]
+
      | #default                = F Y
+
      }}|{{{1|}}} }}<!-- default='dmy'/'iso'/'mdy'/null/""/unsuppplaceed option -->
+
    }}
+
  }}   
+
}}
+

Latest revision as of 12:11, 20 November 2012

This is the "Date" template. It should be called through {{date}}