formula

 BBS: Inland Empire Archive
Date: 06-14-92 (15:23)             Number: 413
From: QUINN TYLER JACKSON          Refer#: 276
  To: JOHN GALLAS                   Recvd: NO  
Subj: formula                        Conf: (2) Quik_Bas
JG>   I need a forumla that'll tell how many days its been between two
JG>dates.  It has to tell weather it has been a leap year or not, and it
JG>has to be fast.  Is it possible?  Any help would be appreciated.

"Thirty days hath September...."

No really, any year evenly divisible by 400 or 4 is a leap year, so,
this code adds a day for leap years....


CONST TRUE = -1
CONST FALSE = NOT TRUE

IF year MOD 400 = 0 OR year MOD 4 = 0 THEN
        LeapYear = TRUE
        IF month > 2 THEN TotalDays = TotalDays + 1
        ELSE
        LeapYear = FALSE
END IF


 * SLMR 2.1a * When I was a kid, up was down, and down was up....

--- Maximus/2 2.01wb
 * Origin: The Nibble's Roost, Richmond BC Canada 604-244-8009 (1:153/918)
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