convert julian dates to calender dates

  • Thread starter Thread starter JH
  • Start date Start date
J

JH

I have a column of 5 digit julian dates (ex 08066) that I need to convert to
a calender date. The julian date is formatted as text. I am using access
2003. I have used the following code but I get only blanks.
Function ConvertJulian(JulianDate As Long) If JulianDate > 40001 Then
ConvertJulian = DateSerial(1900 + Int(JulianDate / 1000), 1, JulianDate
Mod 1000)
Else
ConvertJulian = DateSerial(2000 + Int(JulianDate / 1000), 1, JulianDate
Mod 1000)
End If

End Function
I do not know VBA so I do not know what to fix. Any help or suggestions
would be much appreciated.
 
Try this ---
ConvertJulian:
IIf(Val([JullianDate])>40001,DateSerial(1900+Int([JullianDate]/1000),1,[JullianDate]
Mod 1000),DateSerial(2000+Int([JullianDate]/1000),1,[JullianDate] Mod 1000))
 
Thanks alot. I was able to use this in the query. What I learned from this
and the previous post was very helpful.
--
JH


KARL DEWEY said:
Try this ---
ConvertJulian:
IIf(Val([JullianDate])>40001,DateSerial(1900+Int([JullianDate]/1000),1,[JullianDate]
Mod 1000),DateSerial(2000+Int([JullianDate]/1000),1,[JullianDate] Mod 1000))
--
KARL DEWEY
Build a little - Test a little


JH said:
I have a column of 5 digit julian dates (ex 08066) that I need to convert to
a calender date. The julian date is formatted as text. I am using access
2003. I have used the following code but I get only blanks.
Function ConvertJulian(JulianDate As Long) If JulianDate > 40001 Then
ConvertJulian = DateSerial(1900 + Int(JulianDate / 1000), 1, JulianDate
Mod 1000)
Else
ConvertJulian = DateSerial(2000 + Int(JulianDate / 1000), 1, JulianDate
Mod 1000)
End If

End Function
I do not know VBA so I do not know what to fix. Any help or suggestions
would be much appreciated.
 
Back
Top