Difference between revisions of "Template:MONTHNUMBER"
From CryptoWiki
wiki_crypto>Amorymeltzer m (Changed protection level for "Template:MONTHNUMBER": Allow template editor access, see Template:MONTHNAME ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))) |
wiki_crypto>Hercule |
||
Line 1: | Line 1: | ||
<includeonly>{{#if:{{{1|}}} | <includeonly>{{ safesubst:#if: {{{1|}}} | ||
|{{#switch:{{lc:{{{1}}}}} | | {{ safesubst:#switch: {{ safesubst:lc: {{{1}}} }} | ||
| | | janvier | janv. | jan | january = 1 | ||
|february|feb=2 | | février | févr. | fév | fevrier | fev | february | feb = 2 | ||
| | | mars | mar | march = 3 | ||
| | | avril | avr. | avr | april | apr = 4 | ||
|may=5 | | mai | may = 5 | ||
| | | juin | jun | june = 6 | ||
| | | juillet | juill. | jul | july = 7 | ||
|august|aug=8 | | août | aoû | aout | aou | august | aug = 8 | ||
| | | septembre | sept. | sep | september = 9 | ||
| | | octobre | oct. | oct | october = 10 | ||
| | | novembre | nov. | nov | november = 11 | ||
| | | décembre | déc. | déc | decembre | dec | december = 12 | ||
|{{#ifexpr:{{{1}}} | | #default = {{ safesubst:#ifexpr: ( {{{1}}} ) >= 0 | ||
|{{#ifexpr:(({{{1}}})round 0) | | {{ safesubst:#expr: ( ( ( 10.5 + ( {{{1}}} ) ) round 0 ) mod 12 ) + 1 }} | ||
|{{#expr:12 | | {{ safesubst:#ifexpr: ( ( {{{1}}} ) round 0 ) = ( {{{1}}} ) | ||
|{{#expr:12-((( | | {{ safesubst:#expr: 12 + ( ( {{{1}}} ) mod 12 ) }} | ||
| {{ safesubst:#expr: 12 - ( ( ( .5 - ( {{{1}}} ) ) round 0 ) mod 12 ) }} | |||
}} | }} | ||
}} | }} | ||
}} | }} | ||
| | | <strong class="error">Erreur MONTHNUMBER : paramètre ''mois'' manquant</strong> | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude><!-- | ||
<!-- | Pour limiter le nombre de changements de cette page merci de placer les | ||
</noinclude> | métadonnées (catégories, interwikis) concernant ce modèle dans une | ||
section <includeonly> de sa sous-page de documentation, plutôt qu'ici. | |||
-->{{Documentation}}</noinclude> |
Revision as of 13:54, 6 June 2019
This template is used on 751,000+ pages, or roughly 10226% 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).
Does not play nicely with "subst:"
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
[
] all subsections that follow:This template does not put a working clock on your page. The clock will not update the time on your screen every minute. Instead, it records the date and time that the page was most recently edited or purged. If you want a clock that constantly updates, then go to Special:Preferences#mw-prefsection-gadgets and enable the Appearance item, "Add a clock to the personal toolbar that displays the current time in UTC and provides a link to purge the current page". |
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) {{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) |
|||
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 | {{Dow}} | {{CURRENTDAYNAME}} {{CURRENTWEEKDAYABBREV}} {{CURRENTWEEKDAY}} |
||
MONTH | {{MONTHNAME}} {{MONTHABBREV}} {{MONTHNUMBER}} {{MONTH}} (zero padded) |
{{CURRENTMONTHNAME}} {{CURRENTMONTHABBREV}} {{CURRENTMONTH1}} {{CURRENTMONTHDAYS}} |
{{LASTMONTH}} (Can make not zero-padded) {{LASTMONTHNAME}} |
{{NEXTMONTH}} (Can make not zero-padded) {{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}} | {{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
- {{Calendar}}
- {{Calendar clock with Wikipedia stats}}
- {{Clock}}
- {{Digital clock}}
- {{Digital clock and date}}