Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Wikipedia:Date math

From Wikipedia, the free encyclopedia

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.

Current date and time

[edit]
Built-in variables Templates based on them What you see Comments
{{CURRENTTIMESTAMP}} 20260729024117
{{CURRENTYEAR}} 2026
{{UTC}} 2026-07-29 02:41 UTC also uses {{CURRENTMONTH}} {{CURRENTDAY2}} {{CURRENTTIME}}
{{CURRENTDATE}} 02:41, Wednesday, July 29, 2026 (UTC) also uses {{CURRENTTIME}} {{CURRENTDAYNAME}} {{CURRENTMONTHNAME}} {{CURRENTDAY}}
{{CURRENTJULIANDAY}} 2461250.6120023 current Julian day also uses {{CURRENTMONTH}} {{CURRENTDAY}} {{CURRENTHOUR}} {{CURRENTMINUTE}} {{CURRENTSECOND}}
{{CURRENTMONTH}} 07
{{CURRENTMONTH1}} 7 trims leading zero
{{CURRENTMONTHNAME}} July
{{Month+1}} August
{{Month-1}} June
{{Month-2}} May
{{CURRENTDAY}} 29 day of month
{{CURRENTDOW}} 3 day of week
{{CURRENTDAYNAME}} Wednesday
{{#time:l|-1 day}} Tuesday
{{#time:l}} Wednesday
{{#time:l|+1 day}} Thursday
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}} 02:41
{{CURRENTHOUR}} 02
{{#time:H|+1 hour}} 03
{{Current hour}} 2 trims leading zero
{{#time:i}} 41
{{CURRENTMINUTE}} 41
{{Current minute}} 41 trims leading zero
{{#time:s}} 17
{{CURRENTSECOND}} 17

Computed date and time

[edit]
Template name Usage Output Comment
{{Ordinal date}} {{Ordinal date|year=2007|month=03|day=15}} 74 returns ordinal date (day of year)
{{Ordinal date|year=2008|month=03|day=15}} 75 +1 due to leap year in 2008
{{WEEKDAY}} {{WEEKDAY|2009|08|25}} 2 returns day of week
{{WEEKDAYNAME|{{WEEKDAY|2009|08|25}}}} Tuesday
{{JULIANDAY}} {{JULIANDAY|2009|08|25}} 2455069
{{JULIANDAY|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}}} 2461251 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|2455069}} 20090825120000 same format as {{CURRENTTIMESTAMP}}
{{#time:D Y-m-d|{{JULIANDAY.TIMESTAMP|2455069}}}} Tue 2009-08-25
{{JULIANDAY.DAYNAME}} {{JULIANDAY.DAYNAME|2455069}} Tuesday same format as {{CURRENTDAYNAME}}

Note: 2455069 mod 7 = 1

{{JULIANDAY.DAYNAME|{{CURRENTJULIANDAY}}}} Wednesday

Julian dates or day numbers can be used for date calculations. A simple example follows:

  1. 90 days from 25 December 2006 is:
    • Code: {{#time:j F Y|{{JULIANDAY.TIMESTAMP|{{JULIANDAY|2006|12|25}}+90}}}} → 25 March 2007
  2. 90 days from 25 December 2007 is:
    • Code: {{#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)

Fancy stuff

[edit]
Today is
Tomorrow
{{today cell}} {{tomorrow cell}}

See also

[edit]