Joelo
MIS
- Sep 27, 2003
- 61
Please could anybody help me out on how to convert Julian Date value to Date (mm/dd/yy)
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.
The functions below will convert a Julian date to a standard Excel date, and convert a standard Excel date to a Julian date.
The JDateToDate function will accept a five-character Julian date and return the standard Excel date.
Function JDateToDate(JDate As String) As Long
Dim TheYear As Integer
Dim TheDay As Integer
Dim TheDate As Long
TheYear = CInt(Left(JDate, 2))
If TheYear < 30 Then
TheYear = TheYear + 2000
Else
TheYear = TheYear + 1900
End If
TheDay = CInt(Right(JDate, 3))
TheDate = DateSerial(TheYear, 1, TheDay)
JDateToDate = TheDate
End Function
The DateToJDate function will accept a standard Excel date and return a five-character string representing the Julian date.
Function DateToJDate(TheDate As Long) As String
Dim TheYear As Integer
Dim TheDays As Integer
Dim JDate As String
TheYear = Year(TheDate)
TheDays = DateDiff("d", DateSerial(TheYear, 1, 0), TheDate)
JDate = Right(Format(TheYear, "0000"), 2) & Format(TheDays, "000")
DateToJDate = JDate
End Function