List of utility methods to do Day End
boolean | isEndOfMonth(Date date) is End Of Month Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, 1);
return 1 == cal.get(Calendar.DAY_OF_MONTH);
|
boolean | isEndOfMonth(Date nowday) is End Of Month Calendar ca = Calendar.getInstance(); ca.setTime(nowday); if (ca.get(Calendar.DATE) == ca.getActualMaximum(Calendar.DAY_OF_MONTH)) return true; else return false; |
boolean | isEndOfSeason(Date date) is End Of Season Calendar calendar = getCalender(date); int month = calendar.get(Calendar.MONTH) + 1; if (month % 3 == 2) { return true; return false; |
boolean | isEqualYMD(Date begindate, Date enddate) add by xie compare date only compare year month day boolean isEquals = true; Calendar startCalendar = Calendar.getInstance(); startCalendar.setTime(begindate); Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(enddate); int startYear = startCalendar.get(Calendar.YEAR); int startMonth = startCalendar.get(Calendar.MONTH); int startDay = startCalendar.get(Calendar.DATE); ... |
boolean | isIncludeDay(Date start, Date end, Date target) is Include Day start = initDate(start).getTime();
Calendar endCal = initDate(end);
endCal.add(Calendar.DAY_OF_MONTH, 1);
end = endCal.getTime();
return isIncludeDate(start, end, target);
|
boolean | isInRange(Date myDate, Date dateStart, Date dateEnd) Is the date given in date range return isInSameDayOrAfter(myDate, dateStart) && isInSameDayOrBefore(myDate, dateEnd);
|
boolean | isInWorkDay(Calendar start) Determines whether or not the date falls on a work day (Mon-Fri) final int dayOfWeek = start.get(Calendar.DAY_OF_WEEK); return dayOfWeek > 1 && dayOfWeek < 7; |
boolean | isMoreThenMonth(Date startDate, Date enDate) is More Then Month Calendar c = Calendar.getInstance(); c.setTime(startDate); c.add(Calendar.MONTH, 1); if (enDate.getTime() - c.getTimeInMillis() >= 0) { return true; } else { return false; |
boolean | isNowBetween(Date start, Date end) is Now Between return isBetween(new Date(), todayStartTime(), todayEndTime()); |
boolean | isSameDay(Calendar cal1, Calendar cal2) Checks if two calendar objects are on the same day ignoring time. 28 Mar 2002 13:45 and 28 Mar 2002 06:01 would return true. if (cal1 == null || cal2 == null) throw new IllegalArgumentException("The date must not be null"); return (cal1.get(Calendar.ERA) == cal2.get(Calendar.ERA) && cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR)); |