We help IT Professionals succeed at work.

# Julian date to a format dd/mm/yyyy

on
Medium Priority
817 Views
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¿?
Comment
Watch Question

## View Solution Only

Commented:
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

Commented:
VB

Commented:
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")

Commented:
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.

Commented:
Employee in Civil Service
CERTIFIED EXPERT
Commented:
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

Not the solution you were looking for? Getting a personalized solution is easy.

##### Thanks for using Experts Exchange.

• View three pieces of content (articles, solutions, posts, and videos)
• Ask the experts questions (counted toward content limit)
• Customize your dashboard and profile