Java Utililty Methods Julian Date

List of utility methods to do Julian Date

Description

The list of methods to do Julian Date are organized into topic(s).

Method

intjulian(int date)
julian
int offset = date - MIN_GENERATE_DATE;
int result = MIN_GENERATE_DATE;
while (true) {
    int year = result / 1000;
    int yearEnd = year * 1000 + 365 + (isLeapYear(year) ? 1 : 0);
    if (result + offset <= yearEnd) {
        break;
    offset -= yearEnd - result + 1;
    result += 1000;
return (result + offset);
doublejulianCentury(double JD)
Julian century from the epoch.
return (JD - 2451545.0) / 36525;
doublejulianCentury(double julianDay)
julian Century
return ((julianDay - 2451545.0) / 36525.0);
intjulianDate2JDN(int year, int month, int day)
Converts a Julian date into a Julian day number
int a = (14 - month) / 12;
int y = year + 4800 - a;
int m = month + (12 * a) - 3;
return day + ((153 * m + 2) / 5) + 365 * y + y / 4 - 32083;
doublejulianDay(int day, int month, int year)
julian Day
int a = 0;
int b = 0;
boolean isGregorian = false;
if (year > GRGORIAN_BEGIN_YEAR) {
    isGregorian = true;
} else if (year == GRGORIAN_BEGIN_YEAR) {
    if (month > GRGORIAN_BEGIN_MONTH) {
        isGregorian = true;
...
intjulianDay(int YY, int MM, int DD)
calculation of julianDay based on http://www.imcce.fr/en/grandpublic/temps/jour_julien.php This is slightly slower because of a cusp at 1582, but is accurate before these times.
int GGG = 1;
if (YY < 1582)
    GGG = 0;
if (YY <= 1582 && MM < 10)
    GGG = 0;
if (YY <= 1582 && MM == 10 && DD < 5)
    GGG = 0;
int JD = -1 * (7 * (((MM + 9) / 12) + YY) / 4);
...
longJulianDaysToUnix(double jd)
Julian Days To Unix
return (long) ((jd - 2440587.5) * 86400.0);
voidjulianToString(StringBuilder buf, int julian)
julian To String
int j = julian + 32044;
int g = j / 146097;
int dg = j % 146097;
int c = (dg / 36524 + 1) * 3 / 4;
int dc = dg - c * 36524;
int b = dc / 1461;
int db = dc % 1461;
int a = (db / 365 + 1) * 3 / 4;
...