# Template:Week

## Contents

## Examples[edit]

`"{{week|2005|12|31}}"`

gives "52" [1], and is eqv. with`"{{week|2006|1|0}}"`

gives "0" [2]`"{{week|2006|1|1}}"`

gives "0" [3]`"{{week|2006|1|2}}"`

gives "1" [4]

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

`"{{week|2009|12|31}}"`

gives "53" [5]`"{{week|2010|1|1}}"`

gives "0" [6]`"{{week|2010|1|2}}"`

gives "0" [7]`"{{week|2010|1|3}}"`

gives "0" [8]`"{{week|2010|1|4}}"`

gives "1" [9]

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

`"{{week2|2008|12|28}}"`

gives "52" [10]`"{{week2|2008|12|29}}"`

gives "01" [11]`"{{week2|2008|12|30}}"`

gives "01" [12]`"{{week2|2008|12|31}}"`

gives "01" [13]`"{{week2|2009|1|1}}"`

gives "01" [14]

This function do not adhere to the ISO standard (ISO 8601). Use {{Week2}} instead if it should comply with ISO.

## More examples[edit]

`"{{week|1999|1|4}}"`

gives "1" [15] 1999-W01-1`"{{week|2006|1|4}}"`

gives "1" [16]`"{{week|2006|1|5}}"`

gives "1" [17]`"{{week|2006|1|6}}"`

gives "1" [18]`"{{week|2006|1|7}}"`

gives "1" [19]`"{{week|2006|1|8}}"`

gives "1" [20]`"{{week|2006|1|9}}"`

gives "2" [21]`"{{week|2006|1|10}}"`

gives "2" [22]`"{{week|2006|1|16}}"`

gives "3" [23]`"{{week|2006|2|16}}"`

gives "7" [24]`"{{week|2010|1|4}}"`

gives "1" [25]`"{{week|2004|12|31}}"`

gives "53" [26] 2004-W53-5`"{{week|2005|1|1}}"`

gives "0" [27] 2004-W53-6`"{{week|2006|1|1}}"`

gives "0" [28]`"{{week|2007|12|30}}"`

gives "52" [29]`"{{week|2007|12|31}}"`

gives "1" [30]`"{{week|2008|1|1}}"`

gives "1" [31]`"{{week|2008|1|2}}"`

gives "1" [32]`"{{week|2008|1|3}}"`

gives "1" [33]`"{{week|2008|1|4}}"`

gives "1" [34]`"{{week|2010|2|28}}"`

gives "8" [35]`"{{week|2010|3|01}}"`

gives "9" [36]`"{{week|2010|3|02}}"`

gives "9" [37]`"{{week|2010|3|03}}"`

gives "9" [38]`"{{week|2010|3|04}}"`

gives "9" [39]`"{{week|2010|3|05}}"`

gives "9" [40]`"{{week|2010|3|06}}"`

gives "9" [41]`"{{week|2010|3|07}}"`

gives "9" [42]`"{{week|2010|3|08}}"`

gives "10" [43]

Compare:

- variable {{CURRENTWEEK}} gives 43.

In the current method the ISO year minus the Gregorian year is made a switch index. The rest of the expression has to be put in two versions, for the values -1 and 0. If the index is 1 the week number is simply also 1.

In the other method (first method of [44]) the expression

(({{{2}}}=1)*({{{3}}}<4-( ( 1.25* ({{{1}}}-1) -.4 round 0)+({{{1}}}>250)* (2 - ( ({{{1}}}-1) /100 -.495 round 0) +( ({{{1}}}-1) /400 -.499 round 0) ) + 700000001 ) mod7)-({{{2}}}=12)*({{{3}}}>=35-( ( 1.25* {{{1}}} -.4 round 0)+({{{1}}}>250)* (2 - ( {{{1}}} /100 -.495 round 0) +( {{{1}}} /400 -.499 round 0) ) + 700000001 ) mod7)

for the ISO year minus the Gregorian year is needed five times.