RE: opening hours RDF cal use case

Great use case.

Any thoughts/progress on the Easter Sunday issue?

There do seem to be fairly simple procedural algorithms for doing this, but
a callout to a procedure seems a very ugly approach (begs the question why
not do it all with a procedure). Presumably the algorithm needs to be
refactored into a declarative form (which shouldn't be too difficult, it's
mostly if-thens). But how's cwm at swms?

Cheers,
Danny.

more algorithms at
http://www.hourworld.com/easter.htm#




void
CEasterDlg::GetEasterSunday( WORD wYear, WORD& wMonth, WORD& wDay )
{
    // calculate easter sunday
    // [in]  wYear  - 4-digit year to calculate (but not before 1583)
    // [out] wMonth - month of easter sunday
    // [out] wDay   - day of easter sunday

    WORD wCorrection = 0;

    if( wYear < 1700 )      wCorrection = 4;
    else if( wYear < 1800 ) wCorrection = 5;
    else if( wYear < 1900 ) wCorrection = 6;
    else if( wYear < 2100 ) wCorrection = 0;
    else if( wYear < 2200 ) wCorrection = 1;
    else if( wYear < 2300 ) wCorrection = 2;
    else if( wYear < 2500 ) wCorrection = 3;

    wDay = (19 * (wYear % 19) + 24) % 30;
    wDay = 22 + wDay + ((2 * (wYear % 4) + 4 * (wYear % 7) + 6 * wDay + 5 +
wCorrection) % 7);

    // jump to next month
    if( wDay > 31 )
    {
        wMonth = 4;
        wDay -= 31;
    }
    else
    {
        wMonth = 3;
    }
}

from
http://www.codeproject.com/datetime/easter.asp

Received on Friday, 14 March 2003 05:02:08 UTC