BBS: Inland Empire Archive
Date: 04-16-92 (02:54) Number: 80
From: RICK PEDLEY Refer#: NONE
To: GARY POOL Recvd: NO
Subj: Date Routine Question Conf: (2) Quik_Bas
On 04-13-92 GARY POOL wrote to All...
GP> Does anyone have a good routine that will t/XX/+aUke+a/ll/ the day of
GP> the week from the date? (Sorry, a lot of line noise today).
GP> For example, Call DayOfWeek$(Date$) would call a Function DayOfWeek$
GP> that would return Monday, Tuesday, Wednesday, etc. A friend of mine did
GP> it in assembler on the host, but if I ask him for the algorithm, he will
GP> harrass me to no end. I'm sure that this is something that has been
GP> done many times before, so I'd rather not reinvent the wheel. Thanks in
GP> advance. gp
This'll do it. It's not my code, BTW. I think I translated it from
an Applesoft listing in a Nibble magazine. Also calculate # of days
between two dates.
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)
W& = Z& - W&
PRINT W&; "days between the two dates."
... OFFLINE 1.36 * I just found the last bug.
--- Maximus 2.01wb
* Origin: The BULLpen BBS * Intel 14.4EX (613)549-5168 (1:249/140)