/** * Returns the number of the last day of the month, taking into account * leap years. * * @param month the month. * @param yyyy the year (in the range 1900 to 9999). * * @return the number of the last day of the month. */ public static int lastDayOfMonth(final int month, final int yyyy) { final int result = LAST_DAY_OF_MONTH[month]; if (month != FEBRUARY) { return result; } else if (isLeapYear(yyyy)) { return result + 1; } else { return result; } }
/** * Returns the number of the last day of the month, taking into account * leap years. * * @param month the month. * @param yyyy the year (in the range 1900 to 9999). * * @return the number of the last day of the month. */ public static int lastDayOfMonth(final int month, final int yyyy) { final int result = LAST_DAY_OF_MONTH[month]; if (month != FEBRUARY) { return result; } else if (isLeapYear(yyyy)) { return result + 1; } else { return result; } }
/** * Returns the number of the last day of the month, taking into account * leap years. * * @param month the month. * @param yyyy the year (in the range 1900 to 9999). * * @return the number of the last day of the month. */ public static int lastDayOfMonth(final int month, final int yyyy) { final int result = LAST_DAY_OF_MONTH[month]; if (month != FEBRUARY) { return result; } else if (isLeapYear(yyyy)) { return result + 1; } else { return result; } }
/** * Calculate the serial number from the day, month and year. * <P> * 1-Jan-1900 = 2. * * @param d the day. * @param m the month. * @param y the year. * * @return the serial number from the day, month and year. */ private int calcSerial(final int d, final int m, final int y) { final int yy = ((y - 1900) * 365) + SerialDate.leapYearCount(y - 1); int mm = SerialDate.AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH[m]; if (m > MonthConstants.FEBRUARY) { if (SerialDate.isLeapYear(y)) { mm = mm + 1; } } final int dd = d; return yy + mm + dd + 1; }
/** * Calculate the serial number from the day, month and year. * <P> * 1-Jan-1900 = 2. * * @param d the day. * @param m the month. * @param y the year. * * @return the serial number from the day, month and year. */ private int calcSerial(final int d, final int m, final int y) { final int yy = ((y - 1900) * 365) + SerialDate.leapYearCount(y - 1); int mm = SerialDate.AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH[m]; if (m > MonthConstants.FEBRUARY) { if (SerialDate.isLeapYear(y)) { mm = mm + 1; } } final int dd = d; return yy + mm + dd + 1; }
/** * Calculate the serial number from the day, month and year. * <P> * 1-Jan-1900 = 2. * * @param d the day. * @param m the month. * @param y the year. * * @return the serial number from the day, month and year. */ private int calcSerial(final int d, final int m, final int y) { final int yy = ((y - 1900) * 365) + SerialDate.leapYearCount(y - 1); int mm = SerialDate.AGGREGATE_DAYS_TO_END_OF_PRECEDING_MONTH[m]; if (m > MonthConstants.FEBRUARY) { if (SerialDate.isLeapYear(y)) { mm = mm + 1; } } final int dd = d; return yy + mm + dd + 1; }
/** * Returns true if the specified date is the last day in February (that is, the * 28th in non-leap years, and the 29th in leap years). * * @param d the date to be tested. * * @return a boolean that indicates whether or not the specified date is * the last day of February. */ public static boolean isLastDayOfFebruary(final SerialDate d) { final int dom; if (d.getMonth() == MonthConstants.FEBRUARY) { dom = d.getDayOfMonth(); if (SerialDate.isLeapYear(d.getYYYY())) { return (dom == 29); } else { return (dom == 28); } } else { // not even February return false; } }
/** * Returns true if the specified date is the last day in February (that is, the * 28th in non-leap years, and the 29th in leap years). * * @param d the date to be tested. * * @return a boolean that indicates whether or not the specified date is * the last day of February. */ public static boolean isLastDayOfFebruary(final SerialDate d) { final int dom; if (d.getMonth() == MonthConstants.FEBRUARY) { dom = d.getDayOfMonth(); if (SerialDate.isLeapYear(d.getYYYY())) { return (dom == 29); } else { return (dom == 28); } } else { // not even February return false; } }
/** * Returns true if the specified date is the last day in February (that is, the * 28th in non-leap years, and the 29th in leap years). * * @param d the date to be tested. * * @return a boolean that indicates whether or not the specified date is * the last day of February. */ public static boolean isLastDayOfFebruary(final SerialDate d) { final int dom; if (d.getMonth() == MonthConstants.FEBRUARY) { dom = d.getDayOfMonth(); if (SerialDate.isLeapYear(d.getYYYY())) { return (dom == 29); } else { return (dom == 28); } } else { // not even February return false; } }
y2 = end.getYYYY(); for (year = y1; year == y2; year++) { if (SerialDate.isLeapYear(year)) { feb29 = SerialDate.createInstance(29, MonthConstants.FEBRUARY, year); if (feb29.isInRange(start, end, SerialDate.INCLUDE_SECOND)) {
y2 = end.getYYYY(); for (year = y1; year == y2; year++) { if (SerialDate.isLeapYear(year)) { feb29 = SerialDate.createInstance(29, MonthConstants.FEBRUARY, year); if (feb29.isInRange(start, end, SerialDate.INCLUDE_SECOND)) {
y2 = end.getYYYY(); for (year = y1; year == y2; year++) { if (SerialDate.isLeapYear(year)) { feb29 = SerialDate.createInstance(29, MonthConstants.FEBRUARY, year); if (feb29.isInRange(start, end, SerialDate.INCLUDE_SECOND)) {