This site is supported by donations to The OEIS Foundation.
Template:Monthnum
From OeisWiki
The following documentation is located at Template:Monthnum/doc. [<Edit> Template:Monthnum/doc]
[⧼Purge⧽ Template:Monthnum]
[⧼Purge⧽ Template:Monthnum]
The {{monthnum}} date and time function template changes a full month name, a standard three letter month abbreviation or a month number (up to two digits) from 1 to 12, with or without a leading zero, to the month number, padded left with 0 if necessary to get two decimal digits.
Contents
Usage
- {{monthnum|a full month name, a standard three letter month abbreviation or a month number (up to two digits) from 1 to 12, with or without a leading zero}}
or
- {{monthnum}} which defaults to local month number of OEIS Wiki server
Examples
Examples with valid input
Code Result {{monthnum|january}} 01 {{monthnum|January}} 01 {{monthnum|jul}} 07 {{monthnum|SEPTEMBER}} 09 {{monthnum|4}} 04 {{monthnum|06}} 06 {{monthnum|007}} 07 {{monthnum}} 11
Examples with invalid input
Code Result {{monthnum|Hexember}} Monthnum error: invalid input {{monthnum|13}} Monthnum error: invalid input {{monthnum|-1}} Monthnum error: invalid input {{monthnum|6.5}} Monthnum error: invalid input
Code
<!-- The third column will have its use! The leading zeros in the input are ignored. The output is padded left with 0 if necessary to get 2 decimal digits. --> {{#switch: {{lc: {{{1|{{LOCALMONTHNAME}}}}} }} | january=01 | jan=01 | 1=01 | february=02 | feb=02 | 2=02 | march=03 | mar=03 | 3=03 | april=04 | apr=04 | 4=04 | may=05 | may=05 | 5=05 | june=06 | jun=06 | 6=06 | july=07 | jul=07 | 7=07 | august=08 | aug=08 | 8=08 | september=09 | sep=09 | 9=09 | october=10 | oct=10 | 10=10 | november=11 | nov=11 | 11=11 | december=12 | dec=12 | 12=12 | {{error| Monthnum error: invalid input}} }}
See also
- {{daynum}} gives the weekday number (0 to 6) for (Sun to Sat)
- {{day}} gives the standard three letter weekday abbreviation.
- {{fullday}} gives the full weekday name.
- {{monthnum}} gives the month number (padded left with 0 if necessary to get two decimal digits) (01 to 12)
- {{month}} gives the standard three letter month abbreviation.
- {{fullmonth}} gives the full month name.
- {{days in month}} (or {{monthdays}}) gives the number of days in a month (for any year from 1 AD to 10000 AD)
- {{yearday}} returns the day of year from year, month and monthday (for any year from 1 AD to 10000 AD)
- {{ifleapyear}} or {{if leap year}} returns different values depending on whether a given year is a leap year or a common year (for any year from 1 AD to 10000 AD)
- {{is leap year}} predicate function template returns 1 (if true) or 0 (if false) depending on whether a given year is a leap year or a common year (for any year from 1 AD to 10000 AD)
- {{Century}} returns the century for any nonzero (negative or positive) year
- {{Millennium}} returns the millennium for any nonzero (negative or positive) year
- {{to day of CE}} returns the day of CE (Christ Era) from year, month and monthday (for any year from 1 AD to 10000 AD)
- {{from day of CE}} returns year, month and monthday (for any year from 1 AD to 10000 AD) from the day of CE (Christ Era)
- {{date}} for date mathematics (for any year from 1 AD to 10000 AD) (returns the date offset a specified number of days from a given date)
- {{days between}} for date mathematics (for any years from 1 AD to 10000 AD) (returns the number of days between two dates)