converting julian dates....

sparx

Morphed Human
Local time
Yesterday, 22:56
Joined
Jul 22, 2002
Messages
80
I need a function that will convert a julian date into a regular date (ie 2003-03-06). Anyone have any ideas.

TIA

Sparx
 
I modified the function since it doesn't take into account the 21st century.

Code:
Function ConvertJulian(JulianDate As Long)
    Dim Century As Long
    If Int(JulianDate / 1000) < 30 Then
        Century = 2000
    Else
        Century = 1900
    End If
    ConvertJulian = DateSerial(Century + Int(JulianDate / 1000), _
                       1, JulianDate Mod 1000)
End Function
 
Thanks Pat, hopefully this will solve my issue.
 
The julian date most often used on computer systems is mis-named. It is usually a reference to a date in yyddd format. That's what the above function assumes. So if you enter 03001, you'll get 1/1/2003.
 
Yes, your function worked like a charm Pat, thanks for your help.
 
For future reference Pat, if you don't want people to send you messages directly, then you should probably disable private messaging, just food for thought.
 
Private messages are fine. However if you want private consulting services it is customary to pay for them. Messages in the forum are public, become part of a searchable database, and are useful to all. Private help is useful only to the person receiving the help and does nothing to contribute to the public good.
 
Mile-O's reference was an eye-opener.

Expect that the term "Julian Date" has come to be in the eye of the beholder. For example, in US Army (and probably other services) terminology 'Julian Date' denotes the number of the day of the year, e.g:

Today is 09-Sep-2003
Code:
MyJulian = format(date(), "y")
? MyJulian
252

MyDate = format(dateserial(Year(date()) - 1, 12,31)+ MyJulian, "dd-mmm-yyyy")
? MyDate
09-Sep-2003
 
Pat Hartman said:
Private messages are fine. However if you want private consulting services it is customary to pay for them. Messages in the forum are public, become part of a searchable database, and are useful to all. Private help is useful only to the person receiving the help and does nothing to contribute to the public good.

Amen! That's the whole purpose behind this forum.
 

Users who are viewing this thread

Back
Top Bottom