BBS: Inland Empire Archive Date: 08-11-92 (09:08) Number: 57 From: MONTE FERGUSON Refer#: NONE To: ALL Recvd: NO Subj: Yet-Another-Day-Of-Week A Conf: (2) Quik_Bas
Here's one I picked out of a magazine (Creative Computing?) many many moons ago... I think the equation is called Zeller's Congruance or somesuch. 40 DEF FNYR(Y)=Y+(1900*ABS(Y<1582)) 45 DEF FNDOWTEMP(M,D,Y)=_ (365*Y+D+31*(M-1)- INT(.4*M+2.3)*(1-INT((60+(100/M))/100))+_ INT((Y-INT((60+(100/M))/100))/4)-_ INT(.75*(INT((Y-INT((60+(100/M))/100))/100+1)))) 50 DEF FNDOW(M,D,Y)=FNDOWTEMP(M,D,FNYR(Y))-INT(FNDOWTEMP(M,D,FNYR(Y))/7)*7 55 DEF FNDAY$(M,D,Y)=MID$("SatSunMonTueWedThuFri",FNDOW(M,D,Y)*3+1,3) Forgive the formatting, I pulled this out of an ancient BASICA program (blech). FNDOW(Month,Day,Year) returns 0 to 6 (0=Sat, 1=Sun...6=Fri). Year must be four digits. Example: FNDOW(8,11,1992) returns 3 (Tuesday). FNDAY$(Month,Day,Year) returns a three-character string ("Sun", "Mon", etc). FNYR and FNDOWTEMP are used in FNDOW. Don't ask me how the equation works, I don't have a clue. But it does... --- Cat 1.00 * Origin: Chiba City Cat - Cleveland OH (1:157/200.39)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET