Here you can find the source of eemonth(double serial_number)
public static final double eemonth(double serial_number)
//package com.java2s; //License from project: Apache License public class Main { public static final long GREGORIAN_EPOCH = 1721425; public static final double eemonth(double serial_number) { if (!isFinite(serial_number)) { return Double.NaN; }/*w w w .j av a2s . com*/ if (serial_number < 1) { return 1; } if (serial_number > 60) { serial_number--; } long[] res = jd_to_gregorian((long) serial_number + 2415020); return res[1]; } public static final boolean isFinite(double x) { return !(Double.isInfinite(x) || Double.isNaN(x)); } public static final long[] jd_to_gregorian(long jd) { long wjd, depoch, quadricent, dqc, cent, dcent, quad, dquad, yindex, year, yearday, leapadj; wjd = jd; depoch = wjd - GREGORIAN_EPOCH - 1; quadricent = (depoch / 146097); dqc = mod_long(depoch, 146097); cent = (dqc / 36524); dcent = mod_long(dqc, 36524); quad = (dcent / 1461); dquad = mod_long(dcent, 1461); yindex = (dquad / 365); year = (quadricent * 400) + (cent * 100) + (quad * 4) + yindex; if (!((cent == 4) || (yindex == 4))) { year++; } yearday = wjd - gregorian_to_jd(year, 1, 1); leapadj = ((wjd < gregorian_to_jd(year, 3, 1)) ? 0 : (leap_gregorian(year) ? 1 : 2)); long month = ((((yearday + leapadj) * 12) + 373) / 367); long day = (wjd - gregorian_to_jd(year, month, 1)) + 1; return new long[] { year, month, day }; } private static final long mod_long(long n, long d) { return n - d * (n / d); } public static final long gregorian_to_jd(long year, long month, long day) { return GREGORIAN_EPOCH + (365 * (year - 1)) + ((year - 1) / 4) + (-((year - 1) / 100)) + ((year - 1) / 400) + ((((367 * month) - 362) / 12) + ((month <= 2) ? 0 : (leap_gregorian(year) ? -1 : -2)) + day); } public static final boolean leap_gregorian(long year) { return ((year % 4) == 0) && (!(((year % 100) == 0) && ((year % 400) != 0))); } }