julianToGregorian method
DateTime
julianToGregorian(
- dynamic julianDate
)
Implementation
DateTime julianToGregorian(julianDate) {
//source from: http://keith-wood.name/calendars.html
int z = (julianDate + 0.5).floor();
int a = ((z - 1867216.25) / 36524.25).floor();
a = z + 1 + a - (a / 4).floor();
int b = a + 1524;
int c = ((b - 122.1) / 365.25).floor();
int d = (365.25 * c).floor();
int e = ((b - d) / 30.6001).floor();
int day = b - d - (e * 30.6001).floor();
//var wd = _gMod(julianDate + 1, 7) + 1;
int month = e - (e > 13.5 ? 13 : 1);
int year = c - (month > 2.5 ? 4716 : 4715);
if (year <= 0) {
year--;
} // No year zero
return DateTime(year, (month), day);
}