Template:Date: Difference between revisions
Jump to navigation
Jump to search
[checked revision] | [checked revision] |
(→Usage) |
No edit summary |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly>{{# | <includeonly>{{#vardefine:year|{{#sub:{{#replace:{{{1}}}|-}}|0|4}}}}{{#vardefine:month|{{#sub:{{#replace:{{{1}}}|-}}|4|2}}}}{{#vardefine:day|{{#sub:{{#replace:{{{1}}}|-}}|6|2}}}}{{#switch:{{#var:month}} | ||
|01=January | |01=January | ||
|02=February | |02=February | ||
Line 13: | Line 13: | ||
|12=December | |12=December | ||
|#default=FIXME! | |#default=FIXME! | ||
}} {{#switch:{{# | }} {{#switch:{{#var:day}} | ||
|01=1< | |01=1<sup>st</sup> | ||
|02=2< | |02=2<sup>nd</sup> | ||
|03=3< | |03=3<sup>rd</sup> | ||
|21=21< | |21=21<sup>st</sup> | ||
|22=22< | |22=22<sup>nd</sup> | ||
|23=23< | |23=23<sup>rd</sup> | ||
|31=31< | |31=31<sup>st</sup> | ||
|#default={{# | |#default={{#var:day}}<sup>th</sup> | ||
}} {{# | }} {{#var:year}}</includeonly><noinclude> | ||
</includeonly><noinclude> | |||
==Usage== | ==Usage== | ||
This template parses a date of shape yyyy-mm-dd into spoken language like {{date|1975-03-18}} | This template parses a date of shape yyyy-mm-dd into spoken language like {{date|1975-03-18}} | ||
Line 30: | Line 29: | ||
*'''1''': a date of shape yyyy-mm-dd | *'''1''': a date of shape yyyy-mm-dd | ||
==Examples== | ==Examples== | ||
{| | {|class="wikitable" | ||
|< | !Code | ||
!Result | |||
|- | |||
|<nowiki>{{date|1900-01-01}}</nowiki> | |||
|{{date|1900-01-01}} | |{{date|1900-01-01}} | ||
|- | |- | ||
|< | |<nowiki>{{date|2025-11-22}}</nowiki> | ||
|{{date|2025-11-22}} | |{{date|2025-11-22}} | ||
|- | |- | ||
|< | |<nowiki>{{date|2019-02-31}}</nowiki> | ||
|{{date|2019-02-31}} (rubbish in→rubbish out ;) | |{{date|2019-02-31}} (rubbish in→rubbish out ;) | ||
| | |} | ||
[[category:ContentTemplate]] | |||
{{interwiki}} | |||
[[category: | |||
</noinclude> | </noinclude> |
Latest revision as of 17:12, 8 February 2023
Usage
This template parses a date of shape yyyy-mm-dd into spoken language like March 18th 1975
Parameters
The template hase one obligatory unnamed parameter:
- 1: a date of shape yyyy-mm-dd
Examples
Code | Result |
---|---|
{{date|1900-01-01}} | January 1st 1900 |
{{date|2025-11-22}} | November 22nd 2025 |
{{date|2019-02-31}} | February 31st 2019 (rubbish in→rubbish out ;) |