.

Template:WEEKDAY/doc

Wikicars, a place to share your automotive knowledge
Jump to navigationJump to search
Error creating thumbnail: Unable to save thumbnail to destination
This is a documentation subpage for WEEKDAY/doc (see that page for the template or article itself).
It contains usage information, categories, interlanguage links and other content that is not part of the original page.


This template computes the week day number (from 0 on Monday to 6 on Sunday) for the date of the gregorian calendar (or proleptic) in parameter.

Syntax:
{{WEEKDAY|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.

The julian day number (which is the integer part of the julian day plus one) modulo 7 grows from 0 (on Monday at noon) to 6 (on Sunday at noon)) and returns back to 0 the next day on Monday at noon (however this template ignores time, so this number is valid for the whole day from zero o'clock to midnight). This numbering order matches the order of days in the ISO week (but NOT the absolute numeric value, and not the US week day order and numbering).

Examples:
  • {{WEEKDAY|2000|1|1}} returns {{#if:1|{{#if:1|{{#if:2000|{{#expr:{{#if:2000|{{#expr:((((2000)*12+(1)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2000)*12+(1)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2000)*12+(1)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((1)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(1)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2000|2|28}} returns {{#if:28|{{#if:2|{{#if:2000|{{#expr:{{#if:2000|{{#expr:((((2000)*12+(2)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2000)*12+(2)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2000)*12+(2)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((2)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(28)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2000|3|1}} returns {{#if:1|{{#if:3|{{#if:2000|{{#expr:{{#if:2000|{{#expr:((((2000)*12+(3)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2000)*12+(3)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2000)*12+(3)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((3)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(1)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2000|12|31}} returns {{#if:31|{{#if:12|{{#if:2000|{{#expr:{{#if:2000|{{#expr:((((2000)*12+(12)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2000)*12+(12)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2000)*12+(12)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((12)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(31)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2001|1|1}} returns {{#if:1|{{#if:1|{{#if:2001|{{#expr:{{#if:2001|{{#expr:((((2001)*12+(1)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2001)*12+(1)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2001)*12+(1)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((1)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(1)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2001|2|28}} returns {{#if:28|{{#if:2|{{#if:2001|{{#expr:{{#if:2001|{{#expr:((((2001)*12+(2)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2001)*12+(2)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2001)*12+(2)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((2)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(28)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2001|3|1}} returns {{#if:1|{{#if:3|{{#if:2001|{{#expr:{{#if:2001|{{#expr:((((2001)*12+(3)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2001)*12+(3)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2001)*12+(3)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((3)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(1)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2001|12|31}} returns {{#if:31|{{#if:12|{{#if:2001|{{#expr:{{#if:2001|{{#expr:((((2001)*12+(12)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2001)*12+(12)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2001)*12+(12)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((12)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(31)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2006|2|28}} returns {{#if:28|{{#if:2|{{#if:2006|{{#expr:{{#if:2006|{{#expr:((((2006)*12+(2)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2006)*12+(2)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2006)*12+(2)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((2)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(28)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2006|3|1}} returns {{#if:1|{{#if:3|{{#if:2006|{{#expr:{{#if:2006|{{#expr:((((2006)*12+(3)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2006)*12+(3)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2006)*12+(3)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((3)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(1)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
  • {{WEEKDAY|2006|4|22}} returns {{#if:22|{{#if:4|{{#if:2006|{{#expr:{{#if:2006|{{#expr:((((2006)*12+(4)+57608.5 round 0)/12-1.5 round 0)*1461/4-0.5 round 0)-((((2006)*12+(4)+57608.5 round 0)/12-1.5 round 0)/100-0.5 round 0)+((((2006)*12+(4)+57608.5 round 0)/12-1.5 round 0)/400-0.5 round 0)+((((4)+57608.5 round 0)mod 12+4)*153/5-0.5 round 0)+(22)+(12)/24+(0)/1440+(0)/86400-32167.5}}|Parameter 1=year required!}} mod 7}}|Parameter 1=year required!}}|Parameter 2=month required!}}|Parameter 3=day required!}}
See also:
Template:WEEKDAYNUMBER
Template:WEEKDAYNAME
Template:WEEKDAYABBREV
Template:YEARCC
Template:YEARYY
Template:CENTURY
Template:ISLEAPYEAR
Template:JULIANDAY
Template:ISOYEAR
Template:CURRENTWEEKDAY