Template

YMD to ISO

From Dogcraft Wiki

Revision as of 20:42, 4 April 2022 by Domino (talk | contribs) (from wikipedia (https://en.wikipedia.org/w/index.php?title=Template:YMD_to_ISO))
(diff) โ† Older revision | Latest revision (diff) | Newer revision โ†’ (diff)
Notice: This page uses content from Wikipedia. The original article was at Template:YMD to ISO. The list of authors can be seen in the page history.
Template documentation[view] [edit] [history] [purge]

Script error: No such module "Lua banner".

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 Template:Braces: {{#time: r|2000 January 17}} โ†’ Error: Invalid time.

With the {{Date}} template:

With the {{ISO date}} template:

See also

Template:Hidden