public void setDate(int year, int month, int day, int h, int m, int s) throws Exception {
        // The conversion formulas are from Meeus, chapter 7.
        boolean julian = false;
        if (year < 1582 || (year == 1582 && month <= 10) || (year == 1582 && month == 10 && day < 15)) julian = true;
        if (month < 3) {
            year--;
            month += 12;
        }
        int A = year / 100;
        int B = julian ? 0 : 2 - A + A / 4;

        double dayFraction = (h + (m + (s / 60.0)) / 60.0) / 24.0;

        double jd = dayFraction + (int) (365.25D * (year + 4716)) + (int) (30.6001 * (month + 1)) + day + B - 1524.5;

        if (jd < 2299160.0 && jd >= 2299150.0) {
            throw new Exception("invalid julian day " + jd + ". This date does not exist.");
        }

        ttMinusUT = 0;
        if (year > -600 && year < 2200) {
            double x  = year + (month - 1 + day / 30.0) / 12.0;
            double x2 = x * x, x3 = x2 * x, x4 = x3 * x;
            if (year < 1600) {
                ttMinusUT = 10535.328003326353 - 9.995238627481024 * x + 0.003067307630020489 * x2 - 7.76340698361363E-6 * x3 + 3.1331045394223196E-9 * x4 +
                            8.225530854405553E-12 * x2 * x3 - 7.486164715632051E-15 * x4 * x2 + 1.9362461549678834E-18 * x4 * x3 - 8.489224937827653E-23 * x4 * x4;
            } else {
                ttMinusUT = -1027175.3477559977 + 2523.256625418965 * x - 1.885686849058459 * x2 + 5.869246227888417E-5 * x3 + 3.3379295816475025E-7 * x4 +
                            1.7758961671447929E-10 * x2 * x3 - 2.7889902806153024E-13 * x2 * x4 + 1.0224295822336825E-16 * x3 * x4 - 1.2528102370680435E-20 * x4 * x4;
            }
        }
        setUTDate(jd);
    }
Sets the rise/set times to return. Default is
for the local horizon.

@param T The Twilight.
src/main/java/eu/hansolo/tilesfx/tools/SunMoonCalculator.java