BBS: Inland Empire Archive Date: 04-20-92 (10:28) Number: 165 From: GARY POOL Refer#: 163 To: RICK PEDLEY Recvd: NO Subj: Date Routine Question Conf: (2) Quik_Bas
-> Days$ = "FRISATSUNMONTUEWEDTHU" -> W& = 0 -> FOR I = 1 TO 2 -> INPUT "MM,DD,YYYY: ", M, D, Y -> X = -INT((1 / (M + 1) + .7)) -> Z& = INT((M + 1 - 12 * X) * 30.6001) + INT((Y + X) * 365.25) + D -> X = Z& - 7 * (Z& \ 7) -> DayOfWeek$ = MID$(Days$, X * 3 + 1, 3) -> PRINT DayOfWeek$ -> W& = Z& - W& -> NEXT I -> PRINT W&; "days between the two dates." Unfortunately, upon testing, I've found that this is not accurate. PC Magazine had a 'C' version that reported 07/04/1776 as Thursday. My friend's assembler version did as well (and I KNOW he thoroughly debugged it). This version reported that date as a Tuesday, although today's date was calculated correctly. Something must be off in the figuring of the leap years. I have not tried Dick's solution yet (which only returns today's date -- I should have been more specific and said any date rather than being lazy and using DATE$ as an example). It looked a little confusing to me. I didn't quite understand where the 256 came from in his example. So I think I'm still looking for a date routine. --- WM v2.00/91-0231 * Origin: The Modem Zone BBS (314) 893-5106 (1:289/2)
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