Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As Dword
Function PBMain() As Long
End Function
FUNCTION JulianToCal( BYVAL JulDate AS LONG ) AS STRING
LOCAL Year AS DWORD, Day AS DWORD, Month AS DWORD, Gregorian AS DWORD
LOCAL JulA AS LONG, Jul_Alpha AS LONG, JulB AS LONG, JulC AS LONG
LOCAL JulD AS LONG, JulE AS LONG
Gregorian = 2299161
IF ( JulDate >= Gregorian ) THEN
Jul_Alpha = INT( ( ( JulDate - 1867216 ) - 0.25 ) / 36524.25 )
JulA = ( JulDate + 1 + Jul_Alpha - INT( 0.25 * Jul_Alpha ) )
ELSE
IF JulDate <= 0 THEN ' bad input
FUNCTION = "00/00/00"
EXIT FUNCTION
END IF
JulA = JulDate
END IF
JulB = JulA + 1524
JulC = INT( 6680! + ( ( JulB - 2439870 ) - 122.1 ) / 365.25 )
JulD = INT( 0.25 * JulC ) + ( 365 * JulC )
JulE = INT( ( JulB - JulD ) / 30.6001 )
Day = JulB - JulD - INT( 30.6001 * JulE )
Month = JulE - 1
IF ( Month > 12 ) THEN Month = Month - 12
Year = JulC - 4715
IF ( Month > 2 ) THEN Year = Year - 1
FUNCTION = FORMAT$(Month, "00") + "/" + FORMAT$(Day, "00") + "/" + FORMAT$(Year, "0000")
END FUNCTION
http://www.garybeene.com/sw/gbsnippets.htm