• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:YMD to ISO

  • Template
  • Talk
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]
This template uses Lua:
  • Module:YMD to ISO

{{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.

Contents

  • 1 Usage
  • 2 Examples
    • 2.1 Full month names
    • 2.2 Abbreviated month names
    • 2.3 Dates in other formats (unchanged)
    • 2.4 Used as input
  • 3 See also
    • 3.1 Multiple units of time
    • 3.2 Single units of time
    • 3.3 Date and time templates made for substitution:
      • 3.3.1 Parser functions
      • 3.3.2 Individual templates
      • 3.3.3 Categories of templates

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.

With non-existent dates (unchanged):

  • {{YMD to ISO|2013 February 29}} → 2013 February 29 (2013 was not a leap year)
  • {{YMD to ISO|2012 April 31}} → 2012 April 31 (April does not have 31 days)
  • {{YMD to ISO|2012 March 0}} → 2012 March 0 (valid day ranges are from 1-31)

See also

  • Help:Time function
  • mw:Help:Extension:ParserFunctions § #time
Date and time templates
For the magic words with the same or similar names, see MediaWikiWiki:Help:Magic words § Date and time.
  • v
  • t
  • e

Multiple units of time

Type Adjustable Current Last Next
Date and time {{time}} {{Currentdate}} (MDY)
{{Plain now}} (DMY)
{{Now}} (DMY in a complete sentence)
{{Simple now}}
Date only {{Dateonly}}
{{Datedow}}
(Has the day of the week)
{{Date}} (Chose format)
{{TODAY}} (DMY)
{{Yesterday}}
{{Day-1}}
{{Tomorrow}}
{{Day+1}}
Month and year only {{Monthyear}}

{{DATE}} (prefixed by date=)

{{Monthyear-1}} {{Monthyear+1}}
Time only {{Timeonly}} {{CURRENTTIME}} (12 h format)
{{CURRENTTIME24}} (24 h format)
Banners {{Right now}}
(Blue 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}}
Week {{CURRENTWEEK}}
{{CURRENTWEEKOFMONTH}}
Day of Week {{DAYOFWEEK}} {{CURRENTDAYNAME}}
{{CURRENTWEEKDAYABBREV}}
{{CURRENTWEEKDAY}}
Month {{MONTHNAME}}
{{MONTHABBREV}}
{{MONTHNUMBER}}
{{MONTH}} (zero padded)
{{CURRENTMONTHNAME}}
{{CURRENTMONTHABBREV}}
{{CURRENTMONTH1}}
{{CURRENTMONTHDAYS}}
{{LASTMONTHNAME}} {{NEXTMONTHNAME}}
Day of Month {{CURRENTDAY}}
{{CURRENTDAY2}} (zero padded)
Year {{CURRENTYEARCC}}
{{CURRENTYEARYY}}
{{CURRENTISOYEAR}}
{{CURRENTYEAR}}
{{LASTYEAR}} {{NEXTYEAR}}
Day of Year {{CURRENTDAYOFYEAR}}
Decade {{DECADE}} {{CURRENTDECADE}}
Century {{Century}} {{CURRENTCENTURY}}
MILLENNIUM {{MILLENNIUM}}

Date and time templates made for substitution:

Month:
{{Lmonth}} produces Jul
{{Nmonth}} produces Sep
{{Last month}} produces July 2025
{{Next month}} produces September 2025


Parser functions

  • mw:Special:MyLanguage/time permits a custom time specifier string, similar to the C date and time functions

Individual templates

  • {{Calendar}}
  • {{Calendar clock with Wikipedia stats}}
  • {{Clock}}
  • {{Digital clock}}
  • {{Digital clock and date}}
  • {{Infobox calendar date today}}
  • {{Raph Williams65/digiclock}}

Categories of templates

  • Category:Time, date and calendar templates
  • Category:Date-computing templates
  • Category:Date-computing templates based on current time
  • Category:ISO date templates
  • Category:Calendar 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 (edit) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:YMD_to_ISO&oldid=894585107"
Last edited on 28 April 2019, at 19:21

Languages

    • മലയാളം
    • ਪੰਜਾਬੀ
    • Simple English
    • 中文
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 28 April 2019, at 19:21 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop