Difference between revisions of "Template:ISO8601"

From Wikispooks
Jump to navigation Jump to search
(ISO date format)
 
(Replace #substring:)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>Formats a date as ISO8601.  
+
<noinclude>Formats a date as [http://en.wikipedia.org/wiki/ISO_8601 ISO8601].<br/>
 
'''Usage:'''
 
'''Usage:'''
 
<poem>
 
<poem>
 
{{ISO8601  
 
{{ISO8601  
|DateYear= (0-9999)
+
|publication_dateYear= (0-9999)
|DateMonth= (1-12)
+
|publication_dateMonth= (1-12)
|DateDay= (1-31)
+
|publication_dateDay= (1-31)
 
}}
 
}}
 
</poem>
 
</poem>
</noinclude><includeonly>{{#substring:0000{{{DateYear|}}}|{{#expr: {{#strlen:{{{DateYear|}}}}} - 1}}|4}}-{{#substring:0{{{DateMonth|}}}|{{#expr: {{#strlen:{{{DateMonth|}}}}} - 1}}|2}}-{{#substring:0{{{DateDay|}}}|{{#expr: {{#strlen:{{{DateDay|}}}}} - 1}}|2}}</includeonly>
+
</noinclude><includeonly>{{#sub:0000{{{DateYear|}}}| {{#invoke:String|len|{{{DateYear|}}} }} |4}}-{{#sub:0{{{DateMonth|}}}|{{#expr: {{#invoke:String|len|{{{DateMonth|}}}}} - 1}}|2}}-{{#sub:0{{{DateDay|}}}|{{#expr: {{#invoke:String|len|{{{DateDay|}}}}} - 1}}|2}}</includeonly>

Latest revision as of 06:05, 6 July 2019

Formats a date as ISO8601.
Usage:

{{ISO8601
|publication_dateYear= (0-9999)
|publication_dateMonth= (1-12)
|publication_dateDay= (1-31)
}}