Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function basMsDt2JulDt(DtIn As Date) As String
'DougP 10/03/02 Tek-Tips thread181-5707
Dim YrDt As String 'The year of the serial date.
Dim JulDay As String
YrDt = Format(DtIn, "yyyy") 'Year from MS Date
JulDay = Format(Str(DtIn - DateValue("1/1/" & YrDt) + 1), "000")
basMsDt2JulDt = YrDt & JulDay
End Function
Public Function basJulDt2MsDt(strJulDt As String) As Date
'DougP 10/03/02 Tek-Tips thread181-5707
'converts "Julain" (YYYYDDD) to Ms Date (mm/dd/yy)
' (1999337 to 12/03/99)
Dim Idx As Integer
Dim dtmNewDate As Date
If (Len(strJulDt) <> 7) Then
'See your favorite error handling HERE!
Exit Function
End If
Idx = 1
While Idx <= Len(strJulDt)
MyChr = Mid(strJulDt, Idx, 1)
If (Not IsNumeric(MyChr)) Then
'See your (2nd) favorite error handling HERE!
Exit Function
End If
Idx = Idx + 1
Wend
dtmNewDate = DateSerial(Left$(strJulDt, 4), 1, 1)
dtmNewDate = DateAdd("d", Val(Right$(strJulDt, 3)) - 1, dtmNewDate)
basJulDt2MsDt = Format(dtmNewDate, "mm/dd/yyyy")
End Function