Template:YMD to ISO
Revision as of 08:47, 2 January 2017 by en>Zyxw (update)
This template uses Lua: |
Template:YMD to ISO converts a date in YMD format (e.g. 2000 January 17) to ISO 8601 format (e.g. 2000-01-17). Any input which is not a valid DMY date is passed through unchanged. This template is designed to preprocess dates for use with the #time parser function, which is unable to convert YMD dates, and for use with templates such as {{Date}} or {{ISO date}} which are implemented using the #time parser function.
Usage
{{YMD to ISO | <date in YMD format> }}
Examples
Full month names
- {{YMD to ISO| 2000 January 17 }} → 2000-01-17
- {{YMD to ISO|2000 February 29}} → 2000-02-29
- {{YMD to ISO|2001 February 28}} → 2001-02-28
- {{YMD to ISO|2000 december 17}} → 2000-12-17
- {{YMD to ISO|2000 DECEMBER 17}} → 2000-12-17
Abbreviated month names
- {{YMD to ISO|2000 Sep 1}} → 2000-09-01
- {{YMD to ISO|2000 Sept 1}} → 2000-09-01
- {{YMD to ISO|2000 Sept. 1}} → 2000-09-01
- {{YMD to ISO|2000 dec 1}} → 2000-12-01
- {{YMD to ISO|2000 DEC. 1}} → 2000-12-01
Dates in other formats (unchanged)
- {{YMD to ISO|1 December 2000}} → 1 December 2000
- {{YMD to ISO|December 1, 2000}} → December 1, 2000
Used as input
With the {{#time}} parser function:
- {{#time: r|{{YMD to ISO|2000 January 17}}}} → Mon, 17 Jan 2000 00:00:00 +0000
- without {{YMD to ISO}}: {{#time: r|2000 January 17}} → Error: Invalid time.
With the {{Date}} template:
- {{Date|{{YMD to ISO|2000 January 17}}|dmy}} → 17 January 2000
- without {{YMD to ISO}}: {{Date|2000 January 17|dmy}} → 2000 January 17 (not converted to dmy)
With the {{ISO date}} template:
- {{ISO date|{{YMD to ISO|2000 January 17}}|dmy}} → 2000-01-17
- without {{YMD to ISO}}: {{ISO date|2000 January 17|dmy}} → Error: Invalid time.
See also
Date and time templates
[
] all subsections that follow:Multiple units of time
Type | Adjustable | Current | Last | Next |
---|---|---|---|---|
Date and Time | {{time}} | {{Currentdate}} (MDY) {{Plain now}} (DMY) {{Now}} (Plan now in as sentence) |
||
Date Only | {{Dateonly}} {{Datedow}} (Has the day of the week) |
{{Date}} (Chose format) {{DATE}} (prefixed by date=) {{TODAY}} (DMY) |
{{Yesterday}} {{Day-1}} |
{{Tomorrow}} {{Day+1}} |
Time only | {{Timeonly}} | {{CURRENTTIME}} (12 h format) {{CURRENTTIME24}} (24 h format) |
||
Banners | {{Right now}} (Blue with time and number of Wikipedia articles) {{Right now (User message)}} (Orange with time and number of Wikipedia articles |
|||
Timestamp | {{Timestamp}} (Format YYYYMMDDHHMMSS) |
Single units of time
Unit of time | Adjustable | Current | Last | Next |
---|---|---|---|---|
SECOND | {{CURRENTSECOND}} | |||
MINUTE | {{CURRENTMINUTE}} | |||
HOUR | {{Currenthour}} | {{Hour-1}} | {{Hour+1}} | |
WEEK | {{CURRENTWEEKOFYEAR}} {{CURRENTWEEKOFMONTH}} |
|||
Day of Week | {{Dow}} | {{CURRENTWEEKDAYNAME}} {{CURRENTWEEKDAYABBREV}} {{CURRENTWEEKDAY}} |
{{LASTWEEKDAYNAME}} {{LASTWEEKDAYABBREV}} |
{{NEXTWEEKDAYNAME}} {{NEXTWEEKDAYABBREV}} |
MONTH | {{MONTHNAME}} {{MONTHABBREV}} {{MONTHNUMBER}} {{MONTH}} (zero padded) |
{{Currentmonth}} {{CURRENTMONTHABBREV}} {{CURRENTMONTHNUMBER}} {{CURRENTMONTHDAYS}} |
{{LASTMONTH}} (Can make not zero-padded) {{LASTMONTHNAME}} {{LASTMONTHABBR}} |
{{NEXTMONTH}} (Can make not zero-padded) {{NEXTMONTHNAME}} {{NEXTMONTHABBR}} |
Day of Month | {{Currentday}} | |||
YEAR | {{CURRENTYEARCC}} {{CURRENTYEARYY}} {{CURRENTISOYEAR}} {{CURRENTYEAR}} |
{{LASTYEAR}} | {{NEXTYEAR}} | |
Day of Year | {{CURRENTDAYOFYEAR}} | |||
CENTURY | {{CENTURY}} | {{CURRENTCENTURY}} | {{LASTCENTURY}} | {{NEXTCENTURY}} |
MILLENNIUM | {{MILLENNIUM}} | {{Currentmillennium}} |
Date and time Templates made for substitution:
Month:
{{Lmonth}} produces Oct
{{Nmonth}} produces Dec
{{LastMonth}} produces October 2024
{{NextMonth}} produces December 2024
Individual Templates
- {{Calendar}}
- {{Calendar clock with Wikipedia stats}}
- {{Clock}}
- {{Digital clock}}
- {{Digital clock and date}}
Categories of Templates
The above documentation is transcluded from Template:YMD to ISO/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |