#313 Agregar metodos nuevos a la clase Dates

v4.9
closed
nobody
None
9-URGENT
2014-06-15
2013-08-07
Nelson Florez
No

Agregar los siguientes metodos nuevos a la clase Dates, ubicada en org.openxava.util

    /**
 * Calcula el ultimo dia del año
 * @param date
 * @return
 */
public static Date getLastDayYear(Date date) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    cal.set(Calendar.MONTH, 11);
    cal.set(Calendar.DAY_OF_MONTH, 31);
    return cal.getTime();
}

/**
 * Calcula el ultimo dia del mes
 * @param date
 * @return
 */
public static Date getLastDayMonth(Date date) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    cal.set(cal.get(Calendar.YEAR),
            cal.get(Calendar.MONTH),
            cal.getActualMaximum(Calendar.DAY_OF_MONTH));
    return cal.getTime();
}

/**
 * Calcula el primer dia del mes
 * @param date
 * @return
 */
public static Date getFirstDayMonth(Date date) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    cal.set(cal.get(Calendar.YEAR),
            cal.get(Calendar.MONTH),
            cal.getActualMinimum(Calendar.DAY_OF_MONTH));
    return cal.getTime();
}

Discussion

  • Nelson Florez
    Nelson Florez
    2013-08-07

        public static Date addDay(Date date, int days) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.DATE, days);
        return cal.getTime();
    }
    
     
  • Javier Paniza
    Javier Paniza
    2013-08-08

    • Priority: 1 --> 7-HIGH
     
  • Javier Paniza
    Javier Paniza
    2013-10-02

    • Group: Next_Release_(example) --> v4.9
     
  • Javier Paniza
    Javier Paniza
    2013-10-03

    • Priority: 7-HIGH --> 9-URGENT
     
  • Javier Paniza
    Javier Paniza
    2013-10-08

    • status: open --> closed