Open main menu

22 November – 23 November 2024

Template documentation[view] [edit] [history] [purge]

This template creates a date range with non-breaking spaces between the month and day, and {{spaced ndash}}.

Usage

{{daterangedash|Starting date|Ending date|Date format string}}

Both date values can be in any format accepted by PHP's strtotime() function.

  • Starting date is the starting date for the range.
  • Ending Date is the ending date for the range.
  • Date format string is one of the following:
    • dm: day month (1 January)
    • dmy: day month year (1 January 1900)
    • md: month day (January 1)
    • mdy: month day year (January 1, 1900) – note: a comma will be inserted

If both start and end dates are in the same year, the first year will be omitted. There is no error checking to ensure the start date occurs before the end date.

Known issues

Because this makes use of the #time parser function, it is subject to the function's limitations. For example, it only works for dates between 1 January 111 and 31 December 9999. Furthermore, three-digit years will be displayed with a leading zero: 0111, not 111.

Examples

Description Template code Wikicode equivalent Rendered output
Date and month only {{daterangedash|2012-01-10|2012-02-28|dm}} {{nowrap|10 January}}{{spaced ndash}}{{nowrap|28 February}} 10 January – 28 February
Date month year {{daterangedash|January 1 1999|August 5|dmy}} {{nowrap|1 January}} 1999{{spaced ndash}}{{nowrap|5 August}} 2024 1 January 1999 – 5 August 2024
Month day only {{daterangedash|September 11|September 15|md}} {{nowrap|September 11}}{{spaced ndash}}{{nowrap|September 15}} September 11 – September 15
Month day year, both dates in same year {{daterangedash|April 20 2015|May 14 2015|dmy}} {{nowrap|April 20}}{{spaced ndash}}{{nowrap|May 14,}} 2015 April 20 – May 14, 2015

See also