Open main menu

Template:MONTH

Revision as of 17:04, 25 March 2017 by en>Jo-Jo Eumerus (Changed protection level for "Template:MONTH": Allowing template editors on some templates with full protection dating back to pre-WP:TPROT times which aren't too often or too sensitively used. ([Edit=Require template editor access] (indefinite...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Template documentation[view] [edit] [history] [purge]

This template returns the cyclic integer month number in ISO format (between 01 and 12) of the month whose real number is in parameter. Alternatively, the month can be given with its English name (complete or abbreviated to 3 characters, with capitals or small letters).

Syntax

{{MONTH|month}}
  • The month value is interpreted modulo 12 (extra leading zeroes are ignored, negative numbers are accepted, all numbers are rounded to floor).

Examples for all standard month numbers

{{MONTH|1}} returns 01
{{MONTH|2}} returns 02
{{MONTH|3}} returns 03
{{MONTH|4}} returns 04
{{MONTH|5}} returns 05
{{MONTH|6}} returns 06
{{MONTH|7}} returns 07
{{MONTH|8}} returns 08
{{MONTH|9}} returns 09
{{MONTH|10}} returns 10
{{MONTH|11}} returns 11
{{MONTH|12}} returns 12

Examples for month numbers with extra leading zero

{{MONTH|01}} returns 01
{{MONTH|02}} returns 02
{{MONTH|03}} returns 03
{{MONTH|04}} returns 04
{{MONTH|05}} returns 05
{{MONTH|06}} returns 06
{{MONTH|07}} returns 07
{{MONTH|08}} returns 08
{{MONTH|09}} returns 09

Examples for month number underflows and overflows, from computed values

{{MONTH|-1200}} returns 12
{{MONTH|-1201}} returns 11
{{MONTH|-1212}} returns 12
{{MONTH|-12}} returns 12
{{MONTH|-11}} returns 01
{{MONTH|-10}} returns 02
{{MONTH|-9}} returns 03
{{MONTH|-8}} returns 04
{{MONTH|-7}} returns 05
{{MONTH|-6}} returns 06
{{MONTH|-5}} returns 07
{{MONTH|-4}} returns 08
{{MONTH|-3}} returns 09
{{MONTH|-2}} returns 10
{{MONTH|-1}} returns 11
{{MONTH|-0.9999}} returns 11
{{MONTH|-0.5}} returns 11
{{MONTH|-0.0001}} returns 11
{{MONTH|0}} returns 12
{{MONTH|0.0001}} returns 12
{{MONTH|0.5}} returns 12
{{MONTH|0.9999}} returns 12
{{MONTH|12.0001}} returns 12
{{MONTH|12.5}} returns 12
{{MONTH|12.9999}} returns 12
{{MONTH|13}} returns 01
{{MONTH|14}} returns 02
{{MONTH|24}} returns 12
{{MONTH|1200}} returns 12
{{MONTH|1201}} returns 01
{{MONTH|1212}} returns 12

Example for invalid month name

{{MONTH|xxx}} returns Expression error: Unrecognized word "xxx".

See also

[edit] all subsections that follow:

Multiple units of time

Type Adjustable Current Last Next
Date and Time {{time}} {{Currentdate}} (MDY)
{{Plain now}} (DMY)
{{Now}} (Plan now in as sentence)
Date Only {{Dateonly}}
{{Datedow}}
(Has the day of the week)
{{Date}} (Chose format)
{{DATE}} (prefixed by date=)
{{TODAY}} (DMY)
{{Yesterday}}
{{Day-1}}
{{Tomorrow}}
{{Day+1}}
Time only {{Timeonly}} {{CURRENTTIME}} (12 h format)
{{CURRENTTIME24}} (24 h format)
Banners {{Right now}}
(Blue with time and number of Wikipedia articles)
{{Right now (User message)}}
(Orange with time and number of Wikipedia articles
Timestamp {{Timestamp}}
(Format YYYYMMDDHHMMSS)

Single units of time

Unit of time Adjustable Current Last Next
SECOND {{CURRENTSECOND}}
MINUTE {{CURRENTMINUTE}}
HOUR {{Currenthour}} {{Hour-1}} {{Hour+1}}
WEEK {{CURRENTWEEKOFYEAR}}
{{CURRENTWEEKOFMONTH}}
Day of Week {{Dow}} {{CURRENTWEEKDAYNAME}}
{{CURRENTWEEKDAYABBREV}}
{{CURRENTWEEKDAY}}
{{LASTWEEKDAYNAME}}
{{LASTWEEKDAYABBREV}}
{{NEXTWEEKDAYNAME}}
{{NEXTWEEKDAYABBREV}}
MONTH {{MONTHNAME}}
{{MONTHABBREV}}
{{MONTHNUMBER}}
{{MONTH}} (zero padded)
{{Currentmonth}}
{{CURRENTMONTHABBREV}}
{{CURRENTMONTHNUMBER}}
{{CURRENTMONTHDAYS}}
{{LASTMONTH}}
(Can make not zero-padded)
{{LASTMONTHNAME}}
{{LASTMONTHABBR}}
{{NEXTMONTH}}
(Can make not zero-padded)
{{NEXTMONTHNAME}}
{{NEXTMONTHABBR}}
Day of Month {{Currentday}}
YEAR {{CURRENTYEARCC}}
{{CURRENTYEARYY}}
{{CURRENTISOYEAR}}
{{CURRENTYEAR}}
{{LASTYEAR}} {{NEXTYEAR}}
Day of Year {{CURRENTDAYOFYEAR}}
CENTURY {{CENTURY}} {{CURRENTCENTURY}} {{LASTCENTURY}} {{NEXTCENTURY}}
MILLENNIUM {{MILLENNIUM}} {{Currentmillennium}}

Date and time Templates made for substitution:

Month:
{{Lmonth}} produces Oct
{{Nmonth}} produces Dec
{{LastMonth}} produces October 2024
{{NextMonth}} produces December 2024


Individual Templates

Categories of Templates