Dirk Goldgar said:
The conversion is easy enough with a very little bit of code, but how is
the Julian date actually provided? Does it include the year, or should
one assume the current year? If it includes the year, does it include all
four digits, or should the standard Windows guess be made for two-digit
years?
For example, suppose your Julian date is specified as a string in the form
"YYYY.DDD" or "YY.DDD". Then you could use a function like this:
'------ start of code ------
Function JulianToGregorian(JulianDate As Variant) As Variant
' Convert Julian date (year.day format)into
' Gregorian date (as standard date/time value).
'
' Arguments:
' JulianDate - Variant(String) - input Julian date
' as string in year.day format. May be Null.
' Year values under 100 are interpreted as 2-digit
' years, and will be windowed according to the
' system settings.
'
' Return value:
' Corresponding Gregorian date as a standard date/time
' data type. Null if input was Null, Error(5) if input
' was invalid.
On Error GoTo Err_Handler
Dim strJulDate As String
Dim intDot As Integer
Dim intYear As Integer
Dim intDay As Integer
' Convert Julian data to string if necessary.
strJulDate = JulianDate & vbNullString
If Len(strJulDate) = 0 Then
JulianToGregorian = Null
Else
intDot = InStr(1, strJulDate, ".", vbBinaryCompare)
intYear = CInt(Left$(strJulDate, intDot - 1))
intDay = CInt(Mid$(strJulDate, intDot + 1))
JulianToGregorian = DateSerial(intYear, 1, intDay)
End If
Exit_Point:
Exit Function
Err_Handler:
JulianToGregorian = CVErr(5)
Resume Exit_Point
End Function
'------ end of code ------