Gaan na inhoud


in Wikipedia, die vrye ensiklopedie

Dokumentasie-ikoon Sjabloondokumentasie[sien] [wysig] [geskiedenis] [wis kasgeheue]


[wysig bron]

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 1.
  • 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.


  • 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.


[wysig bron]

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

[wysig bron]

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

[wysig bron]

See also

[wysig bron]