List of utility methods to do Day End
Date | getEndDate(Date beginDate, int resolution) get End Date Calendar cal = new GregorianCalendar(); cal.setTime(beginDate); switch (resolution) { case Calendar.SECOND: cal.add(Calendar.SECOND, 1); break; case Calendar.MINUTE: cal.add(Calendar.MINUTE, 1); ... |
Date | getEndDate(Date date) get End Date Calendar calendar = getFirstOfMonthCalendar(date);
calendar.add(Calendar.MONTH, 1);
calendar.add(Calendar.MILLISECOND, 1);
return calendar.getTime();
|
Date | getEndDate(Date startDate) get End Date Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.setTime(startDate);
calendar.add(Calendar.DAY_OF_YEAR, 16 * 7 - 3);
return calendar.getTime();
|
String | getEndDate(int useMonth) get End Date Calendar calendar = Calendar.getInstance(); int months = calendar.get(Calendar.MONTH); if (useMonth > 0) { calendar.set(Calendar.MONTH, useMonth + months); int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); String ymd = calendar.get(Calendar.YEAR) + ""; ... |
String | getEndDate(String date) get End Date String endDate; int year = getYear(date); int month = getMonth(date); int day = getDate(date); int curDayOfWeek = getDayOfWeek(year, month, day); int endTmp = 7 - curDayOfWeek; Calendar tmpCalendar = Calendar.getInstance(); tmpCalendar.set(year, month - 1, day); ... |
Date | getEndDateByDate(Date date) get End Date By Date Date firstDate = null;
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
firstDate = cal.getTime();
return firstDate;
...
|
Date | getEndDateByYears(Date date, int years) get End Date By Years Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(calendar.YEAR, years);
return calendar.getTime();
|
Date | getEndDateForYear() Return December 31st for the current year return createDate(31, 12, getYear(new Date())); |
Date | getEndDateOfCurrentSemester() get End Date Of Current Semester Calendar cal = Calendar.getInstance(); int month = cal.get(Calendar.MONTH); int year = cal.get(Calendar.YEAR); if (month >= 9 && month <= 2) { cal.set(year, Calendar.APRIL, 1, 0, 0, 0); cal.add(Calendar.SECOND, -1); return cal.getTime(); } else { ... |
Date | getEndDateOfMonth(Date given) get End Date Of Month Calendar calendar = Calendar.getInstance(); calendar.setTime(given); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int date = calendar.get(Calendar.DATE); int eom = 31; if (month == 1) { if (isLeapYear(year)) { ... |