Summary:
Survey of some old techniques of calculating dates in Y2K projects.
These algorithms should be implemented using 32-bit or 9-digit precision arithmetic in the
computer language of your choice. All division is integer division, i.e. you drop the remainder.
For example, 35/4 is 8; to make this clear, the algorithms use the INT function, INT(35/4). These
algorithms make use of the MOD function, the remainder after integer division.
Input: Lilian
Output: YYYY.NNN (N= 1 – 366)
Input: Lilian
Output: DOW (0-6, 0 = Sunday)
WDD = DD
if MM < 3
then (WMM = MM +12, WYYYY = YYYY – 1) else (WMM = MM, WYYYY = YYYY)
DOW = MOD((WDD + 1 + (WMM * 2)
+ INT(((WMM + 1) * 3)/5)
+ WYYYY + INT(WYYYY/4)
– INT(WYYYY/100)
+ INT(WYYYY/400)), 7)