Java Utililty Methods Day End

List of utility methods to do Day End

Description

The list of methods to do Day End are organized into topic(s).

Method

booleanisEndOfMonth(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);
booleanisEndOfMonth(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;
booleanisEndOfSeason(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;
booleanisEqualYMD(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);
...
booleanisIncludeDay(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);
booleanisInRange(Date myDate, Date dateStart, Date dateEnd)
Is the date given in date range
return isInSameDayOrAfter(myDate, dateStart) && isInSameDayOrBefore(myDate, dateEnd);
booleanisInWorkDay(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;
booleanisMoreThenMonth(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;
booleanisNowBetween(Date start, Date end)
is Now Between
return isBetween(new Date(), todayStartTime(), todayEndTime());
booleanisSameDay(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));