converte date julian to greagorian in VBA

I

Ienidualc

Dear friends, I need convert date Julian to gregorian and gregorian to Julian.
Help me.
Thanks
 
I

Ienidualc

Thank you for your response.
but I need "convert date julian to greagorian and gregorian to Julian" in
that exemple (Format):
Date Gregorian Date Jualian
DD/MM/YYYY YYYYJJJ

have a nice day.
thanks again
 
J

JW

Here are two functions tht I use for this purpose. The aDate converts
a Julian date to a regular data. jDate converts regular date to
Julian. I am only returning a 5 digit Julian date, but you can adjust
that to pull in the entire year if needed. HTH
'Gets Julian date from standard date
Function jDate(aDate As Date)
NormDateYear = Format(aDate, "yy")
NormDateDay = Format(Str(aDate - _
DateValue("1/1/" & Str(NormDateYear)) + 1), "000")
jDate = Format(NormDateYear & NormDateDay, "@")
End Function

'Gets standard date from Julian date
Function aDate(jDate As String)
NormDateYear = CInt(Mid(jDate, 1, 2))
If NormDateYear < 30 Then
NormDateYear = NormDateYear + 2000
Else
NormDateYear = NormDateYear + 1900
End If
NormDateDay = CInt(Mid(jDate, 3, 3))
aDate = DateSerial(NormDateYear, _
1, NormDateDay)
End Function
 

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