Foarloage:ISOWEEKDAY

Uut Wikipedia
Zur Navigation springen Zur Suche springen
Dokumentation Dokumentation

Usage

This template computes the ISO weekday number (1=Monday, ..., 7=Sunday) for a given Gregorian date (including proleptic years, down to at least 4800 BC, near the theoretical start of the old Roman calendar, and up to at least 5000 AD).

Alternative weekday number systems are:

  • 1=Monday, ..., 6=Saturday, 0=Sunday, used by variable {{CURRENTDOW}}
    • {{CURRENTDOW}} currently gives 4.
  • 0=Monday, ..., 5=Saturday, 6=Sunday, used by and

The formula used to compute the weekday is purely cyclic, using only modular arithmetic operations and small integers (that can fit exactly within floating point variables), excluding all tests (with limited accepted value ranges). This allows all the parameters to be used linearly, including the month and day which are not required to be within 1 and the total numer of days in the indicated month and/or year.

So for computing the weekday number for a date which is N years, P months and Q days after another date known as y|m|d, you can safely use this template with y+N|m+P|d+Q, instead of having to determine the adjusted three elements of the target date with complex formulas (just to remain within the accepted limits of this function), as long as the target date remains within the Gregorian calendar (or proleptic Gregorian), i.e. after 4800BC, and covering all late Biblic dates, medieval, modern and contemporary dates, as well as future dates for several milleniums.

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

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

Examples where the ISO year is three days into the next gregorian year

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

Examples where the ISO year is three days into the previous gregorian year

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

See also


Gewöönelk sunt wie Binutsere tou loai, sukke Dokumentationen tou skrieuwen. Wan du Froagen tou düsse Foarloage häst, koast do hier ap ju Diskussionssiede staale. Wan deer een Tied loang naan ap oantwouded, kiek moal in ju Düütske, Wäästfräiske af Holloundske Wikipedia ätter ju Foarloage. Juust in dän Biriek fon Dokumentationsfoarloagen wuden uk wäkke Seeken uut ju Läichsorbiske Wikipedia kopiert, deeruum dät dät wäil al ju düütske Wikipedia uut ju Läichsorbiske uurnuumen häd, as me an dän Wältäkst sjucht.