use of java.util.Calendar in project head by mifos.
the class DateUtils method getFistDayOfNextYear.
public static Calendar getFistDayOfNextYear(Calendar cal) {
cal.roll(Calendar.YEAR, 1);
cal.set(Calendar.MONTH, Calendar.JANUARY);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DATE));
Calendar cal1 = new DateTimeService().getCurrentDateTime().toGregorianCalendar();
cal1.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE), 0, 0, 0);
return cal1;
}
use of java.util.Calendar in project head by mifos.
the class DateUtils method getLastDayOfNextYear.
public static Date getLastDayOfNextYear() {
Calendar cal = getCurrentDateCalendar();
cal.set(Calendar.MONTH, Calendar.DECEMBER);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
Calendar cal1 = getCurrentDateCalendar();
cal1.set(cal.get(Calendar.YEAR) + 1, cal.get(Calendar.MONTH), cal.get(Calendar.DATE), 0, 0, 0);
return cal1.getTime();
}
use of java.util.Calendar in project head by mifos.
the class DateUtils method sameMonthYear.
public static boolean sameMonthYear(Date firstDate, Date secondDate) {
Calendar first = Calendar.getInstance();
first.setTime(firstDate);
Calendar second = Calendar.getInstance();
second.setTime(secondDate);
return sameMonthYear(first, second);
}
use of java.util.Calendar in project head by mifos.
the class DateUtils method getLastDayOfCurrentYear.
public static Date getLastDayOfCurrentYear() {
Calendar cal = getCurrentDateCalendar();
cal.set(Calendar.MONTH, Calendar.DECEMBER);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
Calendar cal1 = getCurrentDateCalendar();
cal1.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE), 0, 0, 0);
return new Date(cal1.getTimeInMillis());
}
use of java.util.Calendar in project head by mifos.
the class DateUtils method getNumberOfDaysBetweenTwoDates.
public static long getNumberOfDaysBetweenTwoDates(Date date1, Date date2) {
Calendar cal1 = getCurrentDateCalendar();
Calendar cal2 = getCurrentDateCalendar();
cal1.setTime(getDateWithoutTimeStamp(date1));
cal2.setTime(getDateWithoutTimeStamp(date2));
return ((cal1.getTime().getTime() - cal2.getTime().getTime()) / (24 * 60 * 60 * 1000));
}
Aggregations