FUNCTION JulianDate (Day AS INTEGER, Month AS INTEGER,Year AS INTEGER) AS LONG
DIM A AS INTEGER
DIM B AS INTEGER
DIM Year_Corr AS DOUBLE
B = 0
IF Month <= 2 THEN
DEC(Year)
INC(Month,12)
END IF
IF (Year * 10000.0 + Month * 100.0 + Day >= 15821015.0) THEN
A = Year \ 100
B = 2 - A + A \ 4
END IF
IF Year > 0 THEN
Year_Corr = 0.0
ELSE
Year_Corr = 0.75
END IF
Result = FIX((365.25 * Year - Year_Corr)) + FIX((30.6001 * (Month+1) + Day + 1720994 + B))
END FUNCTION
FUNCTION SDateDiff (Day1 AS INTEGER, Month1 AS INTEGER,Year1 AS INTEGER, _
Day2 AS INTEGER, Month2 AS INTEGER,Year2 AS INTEGER) AS LONG
DIM JDate1 AS LONG
DIM JDate2 AS LONG
JDate1 = JulianDate(Day1, Month1, Year1)
JDate2 = JulianDate(Day2, Month2, Year2)
Result = JDate1 - JDate2
END FUNCTION
|