Public Function JulianDate(ByVal datDate As Date) As Double Dim GGG Dim DD, MM, YY Dim S, A Dim JD, J1 Let MM = Month(datDate) Let DD = Day(datDate) Let YY = Year(datDate) Let GGG = 1
If (YY <= 1585) Then GGG = 0 End If
Let JD = -1 * Int(7 * (Int((MM + 9) / 12) + YY) / 4) Let S = 1
If ((MM - 9) < 0) Then S = -1 End If
Let A = Abs(MM - 9) Let J1 = Int(YY + S * Int(A / 7)) Let J1 = -1 * Int((Int(J1 / 100) + 1) * 3 / 4) Let JD = JD + Int(275 * MM / 9) + DD + (GGG * J1) Let JD = JD + 1721027 + 2 * GGG + 367 * YY
If ((DD = 0) And (MM = 0) And (YY = 0)) Then MsgBox "Please enter a meaningful date!" Else Let JulianDate = JD End If End Function 参考这个,逆向分析一下
http://www.a1vbcode.com/download.asp?ID=1883
Dim GGG
Dim DD, MM, YY
Dim S, A
Dim JD, J1 Let MM = Month(datDate)
Let DD = Day(datDate)
Let YY = Year(datDate)
Let GGG = 1
If (YY <= 1585) Then
GGG = 0
End If
Let JD = -1 * Int(7 * (Int((MM + 9) / 12) + YY) / 4)
Let S = 1
If ((MM - 9) < 0) Then
S = -1
End If
Let A = Abs(MM - 9)
Let J1 = Int(YY + S * Int(A / 7))
Let J1 = -1 * Int((Int(J1 / 100) + 1) * 3 / 4)
Let JD = JD + Int(275 * MM / 9) + DD + (GGG * J1)
Let JD = JD + 1721027 + 2 * GGG + 367 * YY
If ((DD = 0) And (MM = 0) And (YY = 0)) Then
MsgBox "Please enter a meaningful date!"
Else
Let JulianDate = JD
End If
End Function
参考这个,逆向分析一下