[fpc-pascal]Week Day

Rich Pasco pasco at acm.org
Fri Apr 20 04:46:11 CEST 2001

James_Wilson at i2.com asked, about my function Weekday:

> One question; does it properly handle leap years? Is that what the "if M >
> 2 then Y1..." line is for?

Yes and yes, respectively.

Unlike a call to function DayOfWeek in unit SysUtils, my function
Weekday is self-contained; i.e. it encapsulates the entire calendar
algorithm in pure Pascal code with no dependence on external libraries. 
Add a second table giving the number of days in each month and you can
draw the calendar of any month you like.

     - Rich

More information about the fpc-pascal mailing list