Dates

 BBS: Inland Empire Archive
Date: 06-15-92 (16:21)             Number: 437
From: RAY CARSON                   Refer#: NONE
  To: JOHN GALLAS                   Recvd: NO  
Subj: Dates                          Conf: (2) Quik_Bas

JG>    I need a forumla that'll tell how many days its been between
JG> two dates.  It has to tell weather it has been a leap year or not,
JG> and it has to be fast.  Is it possible?  Any help would be

'
---
DEFINT A-Z DECLARE SUB DateToJulian (JD#, JM#, JY#, JJ#) Date1$ = "06-02-1992" Date2$ = "07-15-1992" JM# = VAL(MID$(Date1$, 1, 2)) JD# = VAL(MID$(Date1$, 4, 2)) JY# = VAL(MID$(Date1$, 9, 2)) CALL DateToJulian(JD#, JM#, JY#, JJ#) Day1# = JJ# JM# = VAL(MID$(Date2$, 1, 2)) JD# = VAL(MID$(Date2$, 4, 2)) JY# = VAL(MID$(Date2$, 9, 2)) CALL DateToJulian(JD#, JM#, JY#, JJ#) PRINT "Days difference is"; JJ# - Day1# DEFSNG A-Z SUB DateToJulian (JD#, JM#, JY#, JJ#) IF JM# > 2# THEN JM# = JM# - 3# ELSE JM# = JM# + 9# JY# = JY# - 1# END IF J2# = FIX(JY# / 100#) J1# = JY# - 100# * J2# JJ# = FIX((146097# * J2#) / 4#) + FIX((1461# * J1#) / 4#) + FIX((153# * JM# + 2#) / 5#) + JD# + 1721119# END SUB '
---
Ray Carson --- T.A.G. 2.6c1 Standard * Origin: CSI Online - TagScan Alpha Site 2! (1:106/3198)
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