Template:Daterangedash/doc
< Template:Daterangedash
Jump to navigation
Jump to search
Revision as of 17:44, 21 September 2017 by imported>Howcheng (→Examples)
| This is a documentation subpage for Template:Daterangedash. It contains usage information, categories and other content that is not part of the original template page. |
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.
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 JanuaryTemplate:Spaced ndash28 February |
| Date month year | {{daterangedash|January 1 1999|August 5|dmy}} | {{nowrap|1 January}} 1999{{spaced ndash}}{{nowrap|5 August}} 2025 | 1 JanuaryTemplate:Sp 1999Template:Spaced ndash5 AugustTemplate:Sp 2025 |
| Month day only | {{daterangedash|September 11|September 15|md}} | {{nowrap|September 11}}{{spaced ndash}}{{nowrap|September 15}} | September 11Template:Spaced ndashSeptember 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 20Template:Spaced ndashMay 14, 2015 |
See also
- {{daterange}}