convert julian dates to calender dates

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.
 
K

KARL DEWEY

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))
 
J

JH

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top