Date math on Wikipedia is done with variables, templates and the #time parser function.
Date math on Wikipedia is done with variables, templates and the #time parser function.
In articles, it is almost always preferred to specify a specific static date for a statement or event rather than an automatically generated date. Wikipedia:As of describes how to properly specify such dates.
| Built-in variables | Templates based on them | What you see | Comments |
|---|---|---|---|
{{CURRENTTIMESTAMP}}
|
20260809192701 | ||
{{CURRENTYEAR}}
|
2026 | ||
{{UTC}}
|
2026-08-09 19:27 UTC | also uses {{CURRENTMONTH}} {{CURRENTDAY2}} {{CURRENTTIME}} | |
{{CURRENTDATE}}
|
19:27, Sunday, August 9, 2026 (UTC) | also uses {{CURRENTTIME}} {{CURRENTDAYNAME}} {{CURRENTMONTHNAME}} {{CURRENTDAY}} | |
{{CURRENTJULIANDAY}}
|
2461262.3104282 | current Julian day also uses {{CURRENTMONTH}} {{CURRENTDAY}} {{CURRENTHOUR}} {{CURRENTMINUTE}} {{CURRENTSECOND}} | |
{{CURRENTMONTH}}
|
08 | ||
{{CURRENTMONTH1}}
|
8 | trims leading zero | |
{{CURRENTMONTHNAME}}
|
August | ||
{{Month+1}}
|
September | ||
{{Month-1}}
|
July | ||
{{Month-2}}
|
June | ||
{{CURRENTDAY}}
|
9 | day of month | |
{{CURRENTDOW}}
|
0 | day of week | |
{{CURRENTDAYNAME}}
|
Sunday | ||
{{#time:l|-1 day}}
|
Saturday | ||
{{#time:l}}
|
Sunday | ||
{{#time:l|+1 day}}
|
Monday | ||
| Any variable or template with a resolution of smaller than one day should not be placed in articles. These variables only indicate when the article was parsed and cached; they may lag by many hours or even days compared to the time the page is viewed. | |||
{{CURRENTTIME}}
|
19:27 | ||
{{CURRENTHOUR}}
|
19 | ||
{{#time:H|+1 hour}}
|
20 | ||
{{Current hour}}
|
19 | trims leading zero | |
{{#time:i}}
|
27 | ||
{{CURRENTMINUTE}}
|
27 | ||
{{Current minute}}
|
27 | trims leading zero | |
{{#time:s}}
|
01 | ||
{{CURRENTSECOND}}
|
01 | ||
| Template name | Usage | Output | Comment |
|---|---|---|---|
{{Ordinal date}}
|
{{Ordinal date
|
74 | returns ordinal date (day of year) |
{{Ordinal date
|
75 | +1 due to leap year in 2008 | |
{{WEEKDAY}}
|
{{WEEKDAY
|
2 | returns day of week |
{{WEEKDAYNAME|{{WEEKDAY
|
Tuesday | ||
{{JULIANDAY}}
|
{{JULIANDAY
|
2455069 | |
{{JULIANDAY|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}}
|
2461262 | Nesting templates to get the value of the current Julian day with no decimal portion. Useful for date math between a set point and the current date. | |
{{JULIANDAY.TIMESTAMP}}
|
{{JULIANDAY.TIMESTAMP
|
20090825120000 | same format as {{CURRENTTIMESTAMP}} |
{{#time:D Y-m-d|{{JULIANDAY.TIMESTAMP
|
Tue 2009-08-25 | ||
{{JULIANDAY.DAYNAME}}
|
{{JULIANDAY.DAYNAME
|
Tuesday | same format as {{CURRENTDAYNAME}}
Note: 2455069 mod 7 = 1 |
{{JULIANDAY.DAYNAME
|
Sunday |
Julian dates or day numbers can be used for date calculations. A simple example follows:
{{#time:j F Y|{{JULIANDAY.TIMESTAMP|{{JULIANDAY|2006|12|25}}+90}}}} → 25 March 2007{{#time:j F Y|{{JULIANDAY.TIMESTAMP|{{JULIANDAY|2007|12|25}}+90}}}} → 24 March 2008 (1 day less than first example due to leap year in 2008)| {{today cell}} | {{tomorrow cell}} |
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.