Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example
Function PBMain() As Long
Local Date1$, Date2$
Date1$ = "2015-01-16"
Date2$ = "2016-01-18"
MsgBox "Days between " + Date1$ + " and " + Date2$ + " = " + Str$(AstroDay(Date2$) - AstroDay(Date1$))
End Function
Function AstroDay(TheDate$) As Long
Local y As Double, Year, Month, Day As Long
Year = Val(Left$(TheDate$,4))
Month = Val(Mid$(TheDate$,6 To 7))
Day = Val(Right$(TheDate$,2))
y = year + (month - 2.85) / 12
AstroDay = Int(Int(Int(367 * y) - 1.75 * Int(y) + day) -0.75 * Int(0.01 * y)) + 1721119
End Function
http://www.garybeene.com/sw/gbsnippets.htm