0
|
11401 Views
|
7 Replies
|
2 Total Likes
View groups...
Share
GROUPS:

# Calculating Julian date

Posted 10 years ago
 Folks, I did not find julian date conversion in mathematica 10, so I did a very simple function to evaluate it, using http://scienceworld.wolfram.com/astronomy/JulianDate.html 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]  2.456947090324074*^6
7 Replies
Sort By:
Posted 10 years ago
 Hello all, Just seen this post and this might be usefull. Let me know !Robert Attachments:
Posted 10 years ago
 David,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 http://simbad.u-strasbg.fr/..etc.? 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 10 years ago
 Hi guys!Yang, the API converts hh:MM:ss,also?
Posted 10 years ago
 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: Call the API from front end and click the pink plus sign: In the pulldown menu choose the "Computable Data" 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. Boooommm! Done!
Posted 10 years ago
 CalendarConvert (new in version 10: http://reference.wolfram.com/language/ref/CalendarConvert.html) 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 10 years ago
 David,for astronomy calculations, we need a number format like that 2.456947090324074*^6;
Posted 10 years ago
 Try julianDate[date_DateObject] := Module[{julian0}, julian0 = CalendarConvert[ DateObject[{-4713, 1, 1, 1}, TimeZone -> 0, CalendarType -> "Julian"], "Gregorian"]; DateDifference[julian0, date] ] then julianDate[DateObject[{2014, 10, 16, 14, 10, 04}]]gives 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: http://aa.usno.navy.mil/data/docs/JulianDate.php 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.)
Community posts can be styled and formatted using the Markdown syntax.