Link to home
Start Free TrialLog in
Avatar of DGC
DGC

asked on

VB Date Conversion

How do you convert julian dates to mm/dd/yyyy?
ASKER CERTIFIED SOLUTION
Avatar of BSmiley
BSmiley

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Éric Moreau
I suppose that your Julian date is something like yyddd.

If so, there is something I already use:
Private Sub Command1_Click()
Dim dtmNewDate As Date
Dim strJulianDate As String

    strJulianDate = "99123"
   
    dtmNewDate = DateSerial(Left$(strJulianDate, 2), 1, 1)
    dtmNewDate = DateAdd("d", Val(Right$(strJulianDate, 3)) - 1, dtmNewDate)
    MsgBox Format(dtmNewDate, "mm/dd/yyyy")
End Sub
Avatar of Sharmi
Sharmi

You can use this function to convert julian date


Function ConvertJulian (JulianDate as Long)
ConvertJulian = DateSerial(1900 + _
Int(JulianDate / 1000), _
1, JulianDate Mod 1000)  
End Function


Thanks
Sharmi
Avatar of DGC

ASKER

Thanks for the help.
Avatar of DGC

ASKER

emoreau,
Your comment was great!  I used it and was successful.  I really appreciate the time you took to think about what I had asked.
Thanks!!!
DGC:

It's good that emoreau's answer worked for you, but you assigned the points to me!

In the future, you could reject my answer and then select emoreau's for the points.  (I'm new and just figuring this sort of thing out myself.)

I've posted a question to tech support so they'll adjust the points to give them to emoreau instead.

=Bob
Hi,

I have been directed to this question by BSmiley , I have posted a question for emoreau  to claim the points for this question, (Q.10245416)

Ian
Community Support @ Experts Exchange