How many Days v1.0 2/2

 BBS: Inland Empire Archive
Date: 02-22-93 (11:07)             Number: 386
From: RICK PEDLEY                  Refer#: NONE
  To: CHRIS TRACY                   Recvd: NO  
Subj: How many Days v1.0 2/2         Conf: (2) Quik_Bas
 On 02-20-93 Chris Tracy wrote to All...

 CT> Well... I hope someone can use that... I basically just modified and
 CT> cleaned up (a lot!!) an original version that someone wrote...

Chris, here's another one I translated some time ago from an article
in Nibble magazine. It gives day of the week as a bonus. It'd be
interesting to see whether both routines always give the same result.

'Calculates number of days between any two dates and gives day of week
'for both dates.

DEFINT A-Z
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."



... OFFLINE 1.50  "Network management is like herding cats."

--- Maximus 2.01wb
 * Origin: BULLpen BBS * USR DS 16.8/FAX & ASL (613)549-5168 (1:249/140)
Outer Court
Echo Basic Postings

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