Message Boards Message Boards


Calculating Julian date

Posted 9 years ago
7 Replies
2 Total Likes


I did not find julian date conversion in mathematica 10, so I did a very simple function to evaluate it, using informations.

JD[houratu_, minutetu_, secondstu_, day_, month_, year_] := 
  N[367.*year - IntegerPart[7* (year + IntegerPart[(month + 9)/12.])/4] - 
    IntegerPart[3*(IntegerPart[((year + (month - 9)/7.)/100) + 1]/4)] + 
    IntegerPart[275.*month/9 ] + day + 
    1721028.5 + (hourtu/
      24.) + (minutetu/(24.*60)) + (secondstu/(24.*60*60)), 7];

The time is always calculated for universal time Local.

Ex.: Gregorian Calendar: 16/10/2014, 14:10:04 transform -> Julian date

JD[14, 10, 04, 16, 10, 2014]


POSTED BY: Marcelo De Cicco
7 Replies

Hello all, Just seen this post and this might be usefull. Let me know !


POSTED BY: Robert Pigeon


Soon I will check your conclusion about the zero time, in the url navy.

Suggestion: Have mathematica ever think about integrate the astronomy catalogs as it willi be a fantastic thing for us from astronomy community, as the Mathematica astronmical data is useful but lack many informations.

We have to deal with a lot of catalogs from simbad, vizier etc...

POSTED BY: Marcelo De Cicco

Hi guys!

Yang, the API converts hh:MM:ss,also?

POSTED BY: Marcelo De Cicco

Spoiler for a very lazy dude:

Because this conversion mechanism is available in the Wolfram Alpha, simply use the built-in API in the Wolfram Language desktop app to retrieve the Julian calendar result:

  1. Call the API from front end and click the pink plus sign: enter image description here

  2. In the pulldown menu choose the "Computable Data"

  3. You should have a WolframAlpha[...] template filled with your input and some options. You can use this expression just like anything else in the Wolfram Language. enter image description here

Boooommm! Done!

POSTED BY: Shenghui Yang

CalendarConvert (new in version 10: will convert dates between different calendars. An example from the documentation of its use is

CalendarConvert[ DateObject[{2014, 10, 16, 14, 10, 4}, TimeZone -> 0], "Julian"]

POSTED BY: David Reiss


for astronomy calculations, we need a number format like that 2.456947090324074`*^6;

POSTED BY: Marcelo De Cicco


julianDate[date_DateObject] :=

  julian0 = 
    DateObject[{-4713, 1, 1, 1}, TimeZone -> 0, 
     CalendarType -> "Julian"], "Gregorian"];

  DateDifference[julian0, date]


julianDate[DateObject[{2014, 10, 16, 14, 10, 04}]]


Quantity[2.456947715324074`*^6, "Days"] 

Note that I am using midnight as the reference time for the julian zero date. This URL says that it should be noon: but I set it to midnight to conform to your calculation, and the statement on that site is probably in error: midnight makes the most sense, of course.

(I fixed a small typo in the code of an earlier version of this post.)

POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract