Re: Date/Time converter

 BBS: Inland Empire Archive
Date: 07-07-92 (00:04)             Number: 203
From: ERIC MILLER                  Refer#: NONE
  To: CORIDON HENSHAW               Recvd: NO  
Subj: Re: Date/Time converter        Conf: (2) Quik_Bas
I have code for converting Gregorian to Julian Periods, but
not one that goes backwards...(BTW, Julian periods are #
days from a certain
date, used to calculate # days between dates, and get up into the millions)

FUNCTION JulianD& (Month, Day, Year)

IF (Month < 3) THEN
  Month = Month + 12
  Year = Year - 1
END IF

IntRes1& = 2 - Year / 100 + Year / 400
IntRes2& = INT(365.25 * Year)
IntRes3& = INT(30.6001 * (Month + 1))
JulianD& = IntRes1& + IntRes2& + IntRes3& + Day + 1720994

END FUNCTION

  Just use this on two mm/dd/yyyy and subtract the lesser from
the greater for differences.  I got this out of a Turbo Pascal book,
BTW. (but converted it to QB, of course)

--- QuickBBS 2.75 Ovr
 * Origin: Pretzel Logic BBS 512-497-4552- San Antonio, TX (1:387/401)
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