public static int fixedFromGregorian(int year, int month, int day) {
        int yearM1 = year - 1;
        return 365 * yearM1 +
                yearM1 / 4 -
                yearM1 / 100 +
                yearM1 / 400 +
                (367 * month - 362) / 12 +
                (month <= 2 ? 0 :
                        isLeapYear(year) ? -1 :
                                -2) +
                day;
    }
public static int fixedFromGregorian ( int year , int month , int day ) { int yearM1 = year - 1 ; return 365 * yearM1 + yearM1 / 4 - yearM1 / 100 + yearM1 / 400 + ( 367 * month - 362 ) / 12 + ( month <= 2 ? 0 : isLeapYear ( year ) ? - 1 : - 2 ) + day ; }
the number of days since the <em>epoch</em>,
which is the imaginary beginning of year zero in a hypothetical
backward extension of the Gregorian calendar through time.
See "Calendrical Calculations" by Reingold and Dershowitz.