Template:Date

From Pittsburgh Streets
The {{date}} template formats a date.

The optional omit-year-if-same parameter takes a second date, whose year will be compared to that of the given date. If the years are the same, the year will be omitted in the output. (This is used by the {{rp-paper}} template to reduce redundancy.)

The given date can specify a month only, such as 1979-10 to mean October 1979. This can be useful for some periodicals. It can also specify a year only, such as 2010. This can be useful for a Web page that gives only a year.

Otherwise, if the given string cannot be parsed by #time, it is returned unchanged.

Usage examples

  • {{date|1758-11-27}} → Nov. 27, 1758
  • {{date|1910-04-20|omit-year-if-same=1910-04-19}} → Apr. 20
  • {{date|1959-01-01|omit-year-if-same=1958-12-31}} → Jan. 1, 1959
  • {{date|1979-10}} → Oct. 1979
  • {{date|winter 1957}} → winter 1957
  • {{date|2010}} → 2010
  • {{date}}