Julian dates ( AKA JD) are simply a continuous count of days and fractions since noon Universal Time on January 1, 4713 BC (on the Julian calendar). Julian dates are widely used as time variables within astronomical software.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code to convert Julian Date to Normal Date Time | |
string julianDate = "80145"; | |
int jDate = Convert.ToInt32(julianDate); | |
int day = jDate % 1000; | |
int year = (jDate - day) / 1000; | |
year = (year >= 17) ? year += 1900 : year += 2000; | |
var tempDate = new DateTime(year, 1, 1); | |
var result = tempDate.AddDays(day - 1); | |
// Optional | |
// string date = result.ToString("ddMMyyyy"); | |
input : 80145 | |
Output : 5/24/1980 12:00:00 AM | |
input : 13185 | |
Output : 7/4/2013 12:00:00 AM | |
Thank you
No comments:
Post a Comment