Skip to content
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.

Latest commit

 

History

History
27 lines (23 loc) · 1.26 KB

README.md

File metadata and controls

27 lines (23 loc) · 1.26 KB

1.2425 Day of Week method.

This dow(day of week) algorithm is based on Sakamoto's methods.
Let's take a look at the Sakamoto's codes.

dayofweek(y, m, d)  /* 1 <= m <= 12,  y > 1752 (in the U.K.) */
{
    static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
    y -= m < 3;
    return (y + y/4 - y/100 + y/400 + t[m-1] + d) % 7;
}

The part of equation could be equation as below,

dayofweek(y, m, d)  /* 1 <= m <= 12,  y > 1752 (in the U.K.) */
{
    static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
    y -= m < 3;
    return (1.2425 * y + t[m-1] + d) % 7;
}

Proof

equation

equation