/** * Converts java Date to Julian day count * A Julian day is defined as the number of days since Jan 1, 1. * * @param date * @return julian day */ public static final long dateToJulianDay(Date date) { return millisToJulianDay(date.getTime()); }
/** * Converts java Date to Julian day count * A Julian day is defined as the number of days since Jan 1, 1. * * @param date * @return julian day */ public static final long dateToJulianDay(Date date) { return millisToJulianDay(date.getTime()); }
/** * Returns the days between two dates. Positive values indicate that * the second date is after the first, and negative values indicate, well, * the opposite. * * @param isoEarly the "first date" in ISO DateTime Format * @param isoLate the "second date" in ISO Date Time format * @return the days between the two dates */ public static final long daysBetween(String isoEarly, String isoLate, boolean expanded) throws ParseException { Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTimeZone(getTimeZoneFromDateTime(isoEarly, expanded)); c1.setTime(isoToDate(isoEarly, expanded)); c2.setTimeZone(getTimeZoneFromDateTime(isoLate, expanded)); c2.setTime(isoToDate(isoLate, expanded)); return millisToJulianDay(c2.getTime().getTime()) - millisToJulianDay(c1.getTime().getTime()); }
/** * Returns the days between two dates. Positive values indicate that * the second date is after the first, and negative values indicate, well, * the opposite. * * @param isoEarly the "first date" in ISO DateTime Format * @param isoLate the "second date" in ISO Date Time format * @return the days between the two dates */ public static final long daysBetween(String isoEarly, String isoLate, boolean expanded) throws ParseException { Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTimeZone(getTimeZoneFromDateTime(isoEarly, expanded)); c1.setTime(isoToDate(isoEarly, expanded)); c2.setTimeZone(getTimeZoneFromDateTime(isoLate, expanded)); c2.setTime(isoToDate(isoLate, expanded)); return millisToJulianDay(c2.getTime().getTime()) - millisToJulianDay(c1.getTime().getTime()); }