• Home
  • Random
  • Nearby
  • Log in
  • Settings
Donate Now If Wikipedia is useful to you, please give today.
  • About Wikipedia
  • Disclaimers
Wikipedia

Template:MONTHNUMBER

  • Template
  • Talk
  • Language
  • Watch
  • View source
Template documentation[view] [edit] [history] [purge]
WarningThis template is used on 607,000+ pages, or roughly 1% of all pages.
To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.

This template returns the cyclic integer month number (between 1 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).

Contents

  • 1 Syntax
  • 2 Examples for all standard English month names
  • 3 Examples for all abbreviated English month names
  • 4 Examples for all standard month numbers
  • 5 Examples for month numbers with extra leading zero
  • 6 Examples for month number underflows and overflows, from computed values
  • 7 Example for invalid month name
  • 8 See also
    • 8.1 Multiple units of time
    • 8.2 Single units of time
    • 8.3 Date and time templates made for substitution:
      • 8.3.1 Parser functions
      • 8.3.2 Individual templates
      • 8.3.3 Categories of templates

Syntax

{{MONTHNUMBER|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 English month names

{{MONTHNUMBER|january}} returns 1
{{MONTHNUMBER|february}} returns 2
{{MONTHNUMBER|march}} returns 3
{{MONTHNUMBER|april}} returns 4
{{MONTHNUMBER|may}} returns 5
{{MONTHNUMBER|june}} returns 6
{{MONTHNUMBER|july}} returns 7
{{MONTHNUMBER|august}} returns 8
{{MONTHNUMBER|september}} returns 9
{{MONTHNUMBER|october}} returns 10
{{MONTHNUMBER|november}} returns 11
{{MONTHNUMBER|december}} returns 12

Examples for all abbreviated English month names

{{MONTHNUMBER|jan}} returns 1
{{MONTHNUMBER|feb}} returns 2
{{MONTHNUMBER|mar}} returns 3
{{MONTHNUMBER|apr}} returns 4
{{MONTHNUMBER|may}} returns 5
{{MONTHNUMBER|jun}} returns 6
{{MONTHNUMBER|jul}} returns 7
{{MONTHNUMBER|aug}} returns 8
{{MONTHNUMBER|sep}} returns 9
{{MONTHNUMBER|oct}} returns 10
{{MONTHNUMBER|nov}} returns 11
{{MONTHNUMBER|dec}} returns 12

Examples for all standard month numbers

{{MONTHNUMBER|1}} returns 1
{{MONTHNUMBER|2}} returns 2
{{MONTHNUMBER|3}} returns 3
{{MONTHNUMBER|4}} returns 4
{{MONTHNUMBER|5}} returns 5
{{MONTHNUMBER|6}} returns 6
{{MONTHNUMBER|7}} returns 7
{{MONTHNUMBER|8}} returns 8
{{MONTHNUMBER|9}} returns 9
{{MONTHNUMBER|10}} returns 10
{{MONTHNUMBER|11}} returns 11
{{MONTHNUMBER|12}} returns 12

Examples for month numbers with extra leading zero

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

Examples for month number underflows and overflows, from computed values

{{MONTHNUMBER|-1200}} returns 12
{{MONTHNUMBER|-1201}} returns 11
{{MONTHNUMBER|-1212}} returns 12
{{MONTHNUMBER|-12}} returns 12
{{MONTHNUMBER|-11}} returns 1
{{MONTHNUMBER|-10}} returns 2
{{MONTHNUMBER|-9}} returns 3
{{MONTHNUMBER|-8}} returns 4
{{MONTHNUMBER|-7}} returns 5
{{MONTHNUMBER|-6}} returns 6
{{MONTHNUMBER|-5}} returns 7
{{MONTHNUMBER|-4}} returns 8
{{MONTHNUMBER|-3}} returns 9
{{MONTHNUMBER|-2}} returns 10
{{MONTHNUMBER|-1}} returns 11
{{MONTHNUMBER|-0.9999}} returns 11
{{MONTHNUMBER|-0.5}} returns 11
{{MONTHNUMBER|-0.0001}} returns 11
{{MONTHNUMBER|0}} returns 12
{{MONTHNUMBER|0.0001}} returns 12
{{MONTHNUMBER|0.5}} returns 12
{{MONTHNUMBER|0.9999}} returns 12
{{MONTHNUMBER|12.0001}} returns 12
{{MONTHNUMBER|12.5}} returns 12
{{MONTHNUMBER|12.9999}} returns 12
{{MONTHNUMBER|13}} returns 1
{{MONTHNUMBER|14}} returns 2
{{MONTHNUMBER|24}} returns 12
{{MONTHNUMBER|1200}} returns 12
{{MONTHNUMBER|1201}} returns 1
{{MONTHNUMBER|1212}} returns 12

Example for invalid month name

{{MONTHNUMBER|xx}} returns Expression error: Unrecognized word "xx".

See also

For the magic words with the same or similar names, see MediaWikiWiki:Help:Magic words § Date and time.
  • v
  • t
  • e

Multiple units of time

Type Adjustable Current Last Next
Date and time {{time}} {{Currentdate}} (MDY)
{{Plain now}} (DMY)
{{Now}} (DMY in a complete sentence)
{{Simple now}}
Date only {{Dateonly}}
{{Datedow}}
(Has the day of the week)
{{Date}} (Chose format)
{{TODAY}} (DMY)
{{Yesterday}}
{{Day-1}}
{{Tomorrow}}
{{Day+1}}
Month and year only {{Monthyear}}

{{DATE}} (prefixed by date=)

{{Monthyear-1}} {{Monthyear+1}}
Time only {{Timeonly}} {{CURRENTTIME}} (12 h format)
{{CURRENTTIME24}} (24 h format)
Banners {{Right now}}
(Blue 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}}
Week {{CURRENTWEEK}}
{{CURRENTWEEKOFMONTH}}
Day of Week {{DAYOFWEEK}} {{CURRENTDAYNAME}}
{{CURRENTWEEKDAYABBREV}}
{{CURRENTWEEKDAY}}
Month {{MONTHNAME}}
{{MONTHABBREV}}
{{MONTHNUMBER}}
{{MONTH}} (zero padded)
{{CURRENTMONTHNAME}}
{{CURRENTMONTHABBREV}}
{{CURRENTMONTH1}}
{{CURRENTMONTHDAYS}}
{{LASTMONTHNAME}} {{NEXTMONTHNAME}}
Day of Month {{CURRENTDAY}}
{{CURRENTDAY2}} (zero padded)
Year {{CURRENTYEARCC}}
{{CURRENTYEARYY}}
{{CURRENTISOYEAR}}
{{CURRENTYEAR}}
{{LASTYEAR}} {{NEXTYEAR}}
Day of Year {{CURRENTDAYOFYEAR}}
Decade {{DECADE}} {{CURRENTDECADE}}
Century {{Century}} {{CURRENTCENTURY}}
MILLENNIUM {{MILLENNIUM}}

Date and time templates made for substitution:

Month:
{{Lmonth}} produces Jul
{{Nmonth}} produces Sep
{{Last month}} produces July 2025
{{Next month}} produces September 2025


Parser functions

  • mw:Special:MyLanguage/time permits a custom time specifier string, similar to the C date and time functions

Individual templates

  • {{Calendar}}
  • {{Calendar clock with Wikipedia stats}}
  • {{Clock}}
  • {{Digital clock}}
  • {{Digital clock and date}}
  • {{Infobox calendar date today}}
  • {{Raph Williams65/digiclock}}

Categories of templates

  • Category:Time, date and calendar templates
  • Category:Date-computing templates
  • Category:Date-computing templates based on current time
  • Category:ISO date templates
  • Category:Calendar templates
The above documentation is transcluded from Template:MONTHNUMBER/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Template:MONTHNUMBER&oldid=1204293807"
Last edited on 6 February 2024, at 21:07

Languages

    • Afrikaans
    • ak:Nhwɛsode:MONTHNUMBER
    • Alemannisch
    • Anarâškielâ
    • Ænglisc
    • Аԥсшәа
    • العربية
    • ܐܪܡܝܐ
    • Արեւմտահայերէն
    • Arpetan
    • অসমীয়া
    • Asturianu
    • Авар
    • Azərbaycanca
    • Basa Bali
    • বাংলা
    • 閩南語 / Bân-lâm-gí
    • Башҡортса
    • Беларуская
    • Беларуская (тарашкевіца)
    • भोजपुरी
    • Bikol Central
    • Български
    • Boarisch
    • Bosanski
    • Català
    • Чӑвашла
    • Cebuano
    • Chamoru
    • Chavacano de Zamboanga
    • Corsu
    • Cymraeg
    • Dansk
    • الدارجة
    • Deutsch
    • Dolnoserbski
    • डोटेली
    • ཇོང་ཁ
    • Eesti
    • Ελληνικά
    • Español
    • Esperanto
    • Euskara
    • فارسی
    • Føroyskt
    • Français
    • Gaeilge
    • Gàidhlig
    • Galego
    • ГӀалгӀай
    • ગુજરાતી
    • Gungbe
    • 客家語 / Hak-kâ-ngî
    • 한국어
    • Hausa
    • Հայերեն
    • Hornjoserbsce
    • Hrvatski
    • Bahasa Hulontalo
    • Ilokano
    • Bahasa Indonesia
    • Íslenska
    • Italiano
    • עברית
    • Jawa
    • ಕನ್ನಡ
    • ქართული
    • Қазақша
    • Kiswahili
    • Kurdî
    • Кыргызча
    • ລາວ
    • Latviešu
    • Лезги
    • Magyar
    • मैथिली
    • Македонски
    • Malagasy
    • മലയാളം
    • Malti
    • Māori
    • मराठी
    • مصرى
    • ဘာသာမန်
    • مازِرونی
    • Bahasa Melayu
    • 閩東語 / Mìng-dĕ̤ng-ngṳ̄
    • Mirandés
    • Монгол
    • မြန်မာဘာသာ
    • Nederlands
    • Nēhiyawēwin / ᓀᐦᐃᔭᐍᐏᐣ
    • नेपाली
    • 日本語
    • Нохчийн
    • Occitan
    • ଓଡ଼ିଆ
    • Oʻzbekcha / ўзбекча
    • ਪੰਜਾਬੀ
    • پښتو
    • ភាសាខ្មែរ
    • Tok Pisin
    • Polski
    • Português
    • Română
    • Rumantsch
    • Русский
    • Саха тыла
    • Sakizaya
    • संस्कृतम्
    • Sardu
    • Scots
    • Shqip
    • සිංහල
    • Simple English
    • سنڌي
    • Slovenčina
    • Slovenščina
    • کوردی
    • Sranantongo
    • Српски / srpski
    • Srpskohrvatski / српскохрватски
    • Sunda
    • Suomi
    • Svenska
    • தமிழ்
    • Taqbaylit
    • Tarandíne
    • Татарча / tatarça
    • တႆး
    • తెలుగు
    • ไทย
    • ትግርኛ
    • ತುಳು
    • Türkçe
    • Basa Ugi
    • Українська
    • اردو
    • Vèneto
    • Tiếng Việt
    • Volapük
    • 吴语
    • Yorùbá
    • 粵語
    • Zazaki
    • 中文
    • Kumoring
    • ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ
    Wikipedia
    • Wikimedia Foundation
    • Powered by MediaWiki
    • This page was last edited on 6 February 2024, at 21:07 (UTC).
    • Content is available under CC BY-SA 4.0 unless otherwise noted.
    • Privacy policy
    • About Wikipedia
    • Disclaimers
    • Contact Wikipedia
    • Code of Conduct
    • Developers
    • Statistics
    • Cookie statement
    • Terms of Use
    • Desktop