Julian date to a format dd/mm/yyyy

Hello,
I have a formula to obtain the Julian date that is the follow:

a=(14-month)/12
y = year + 4800 - a
m = month + 12a - 3

JD = day + (153m +23)/5 + 365y + y/4 - 32045

Has anyone used this function before┬┐?

And now to obtain the function that converts a date julian to string format normal date┬┐?
1469Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Arthur_WoodCommented:
what programming language are you using?  

subtract 2451700 (which is the JD for Jan 1, 2000) from the JD that you want to convert, and then add (or subtract as the case may be) that many days from Jan 1, 2000 to get the date the corresponds to the JD that you have.

AW
0
1469Author Commented:
VB
0
Arthur_WoodCommented:
You have asked this precise question elsewhere (Math & Science), and that violates the EE rule about offering more than 500 points TOTAL for a question.  You have also accepted the answer provided in the other question, so there seems to be very little to be served by offereing an answer here.

To get the Current Date from a give JD, in VB or VBA:

Dim strCurentDate as string
 
strCurrentDate = Format(DateAdd("d", JD - 2451700, #Jan 1, 2000#), "MMM dd, YYYY")
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

moorhouselondonCommented:
You might be able to get both questions cut down to 250 points each.  I for one am interested in both the programming angle and the historical angle.
0
moorhouselondonCommented:
0
Ralf KlattEmployee in Civil ServiceCommented:
Hi,

This function will return the exact Julian Date for a given vbDate entry:


'The Function:
Public Function JulianDate(ByVal datDate As Date) As Double
    Dim GGG
    Dim DD, MM, YY
    Dim S, A
    Dim JD, J1
    Let MM = Month(datDate)
    Let DD = Day(datDate)
    Let YY = Year(datDate)
    Let GGG = 1
    If (YY <= 1585) Then
        GGG = 0
    End If
    Let JD = -1 * Int(7 * (Int((MM + 9) / 12) + YY) / 4)
    Let S = 1
    If ((MM - 9) < 0) Then
        S = -1
    End If
    Let A = Abs(MM - 9)
    Let J1 = Int(YY + S * Int(A / 7))
    Let J1 = -1 * Int((Int(J1 / 100) + 1) * 3 / 4)
    Let JD = JD + Int(275 * MM / 9) + DD + (GGG * J1)
    Let JD = JD + 1721027 + 2 * GGG + 367 * YY
    If ((DD = 0) And (MM = 0) And (YY = 0)) Then
      MsgBox "Please enter a meaningful date!"
    Else
      Let JulianDate = JD
    End If
    Exit Function
JulianDate_Error:
    MsgBox "MainModule.JulianDate()"
    Exit Function
    Resume
End Function

'How to call the function:
Private Sub Command1_Click()
    MsgBox (JulianDate(Now))
End Sub


To verify the results of the suggested piece of code you might check the generated result using the Julian Date Converter at: http://aa.usno.navy.mil/data/docs/JulianDate.html


PS: I'll post this answer at both channels -> I think it's worth it! ... ;-)
Best regards,
Raisor
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.