Difference between revisions of "Template:Weekday in month"

From Geohashing
imported>Tjtrumpet2323
 
imported>Tjtrumpet2323
m
 
Line 1: Line 1:
 
<includeonly>{{#ifexpr: {{{4}}} < 0
 
<includeonly>{{#ifexpr: {{{4}}} < 0
|{{#expr: 7 * ({{Weekdays in month|{{{1}}}|{{{2}}}|{{{3}}}}} + 1 {{{4}}}) - 6 + ( 7 + {{{3}}} - {{weekday|{{{1}}}|{{{2}}}|1}} ) mod 7 }}
+
|{{#expr: 7 * ({{Weekdays in month|{{{1}}}|{{{2}}}|{{{3}}}}} + 1 {{{4}}}) - 6 + ( 7 + {{{3}}} - {{#expr:{{WEEKDAY|{{{1}}}|{{{2}}}|1}} + 1 mod 7}} ) mod 7 }}
|{{#expr: 7 * {{{4}}} - 6 + ( 7 + {{{3}}} - {{weekday|{{{1}}}|{{{2}}}|1}} ) mod 7 }}
+
|{{#expr: 7 * {{{4}}} - 6 + ( 7 + {{{3}}} - {{#expr:{{WEEKDAY|{{{1}}}|{{{2}}}|1}} + 1 mod 7}} ) mod 7 }}
 
}}</includeonly><noinclude>
 
}}</includeonly><noinclude>
 
Raw formula: 7 * Q - 6 + (N - DoW(Year,Month,1)) % 7
 
Raw formula: 7 * Q - 6 + (N - DoW(Year,Month,1)) % 7

Latest revision as of 21:10, 6 June 2008

Raw formula: 7 * Q - 6 + (N - DoW(Year,Month,1)) % 7

Parameters:

  1. year
  2. month
  3. N=weekday: 0=Sunday, ... 6=Saturday
  4. Q=1 for first N-day, 2 for second, etc... or -1 for last N-day, -2 for second to last, etc...


Holiday 2006 2007 2008 2009 2010
MLK Jr Day -- 3rd Monday in January Jan 16 = 16 Jan 15 = 15 Jan 21 = 21 Jan 19 = 19 Jan 18 = 18
Presidents Day -- 3rd Monday in February Feb 20 = 20 Feb 19 = 19 Feb 18 = 18 Feb 16 = 16 Feb 15 = 15
Mothers Day -- 2nd Sunday in May May 14 = 14 May 13 = 13 May 11 = 11 May 10 = 10 May 9 = 9
Memorial Day -- Last Monday in May May 29 = 29 May 28 = 28 May 26 = 26 May 25 = 25 May 31 = 31
Fathers Day -- 3rd Sunday in June Jun 18 = 18 Jun 17 = 17 Jun 15 = 15 Jun 21 = 21 Jun 20 = 20
Labor Day -- 1st Monday in September Sep 4 = 4 Sep 3 = 3 Sep 1 = 1 Sep 7 = 7 Sep 6 = 6
Columbus Day -- 2nd Monday in October Oct 9 = 9 Oct 8 = 8 Oct 13 = 13 Oct 12 = 12 Oct 11 = 11
Thanksgiving -- 4th Thursday in November Nov 23 = 23 Nov 22 = 22 Nov 27 = 27 Nov 26 = 26 Nov 25 = 25

See also