Template:DOW

From Meta, a Wikimedia project coordination wiki
Jump to navigation Jump to search

This template computes the ISO weekday number (1=Monday, 7=Sunday) for a given Gregorian date.

It has been especially useful for dates before 1 January 1970, because they were outside the range of #time.

{{DOW|2006|1|3}} gives 2.

Compare {{#time:w|20060103}} giving 2.

{{subst:DOW|2006|1|3|subst=subst:}} gives the wikitext 2.

Alternative weekday number systems are:

Syntax:

{{DOW|year|month|day}}
  • The year must be astronomical (year=1 in 1 AD (Anno Domini), year=0 in 1 BC, year=-1 in 2 BC).
  • The month is between 1 and 12 from january to december.
  • The day is normally between 1 and 31.

Examples[edit]

  • "{{DOW|2005|12|31}}" gives "6" [1], and is eqv. with "{{DOW|2006|1|0}}" gives "6" [2]
  • "{{DOW|2006|1|1}}" gives "7" [3]
  • "{{DOW|2006|1|2}}" gives "1" [4]

Examples where the ISO year is three days into the next gregorian year[edit]

  • "{{DOW|2009|12|31}}" gives "4" [5]
  • "{{DOW|2010|1|1}}" gives "5" [6]
  • "{{DOW|2010|1|2}}" gives "6" [7]
  • "{{DOW|2010|1|3}}" gives "7" [8]
  • "{{DOW|2010|1|4}}" gives "1" [9]

Examples where the ISO year is three days into the previous Gregorian year[edit]

  • "{{DOW|2008|12|28}}" gives "7" [10]
  • "{{DOW|2008|12|29}}" gives "1" [11]
  • "{{DOW|2008|12|30}}" gives "2" [12]
  • "{{DOW|2008|12|31}}" gives "3" [13]
  • "{{DOW|2009|1|1}}" gives "4" [14]


  • {{CURRENTDOW}} gives 6
  • integer MJD of Thursday of the week: 58906
  • isoyear: 2020
  • integer MJD of Thursday of the week of 1 Jan of the same year: 58850
  • week number:

Saturday

See also: