Java Utililty Methods Day of

List of utility methods to do Day of

Description

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

Method

booleanisDiffIsBiggerThanMin(Date lastLogIn, Date now, Long daysL)
is Diff Is Bigger Than Min
long diffinDays = diffInDays(lastLogIn, now);
Boolean resultValue = diffinDays > daysL;
return resultValue;
booleanisEndOfDay(GregorianCalendar cal1)
is End Of Day
return guiTimeFormat(cal1).equals(END_OF_DAY);
booleanisHoliday(Date date, String[] excludes, String[] includes)
is Holiday
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMdd");
if (date == null) {
    date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int week = calendar.get(Calendar.DAY_OF_WEEK);
String today = simpleDateFormat.format(calendar.getTime());
...
booleanisIn(int reserveDayCount, String dateString)
is In
Date date = date(dateString);
int interval = interval(date, new Date());
if (interval < 0) {
    return reserveDayCount > Math.abs(interval);
return false;
booleanisInAllDayFormat(String date)
Check if the date is into format yyyyMMdd or yyyy-MM-dd.
String pattern = getDateFormat(date);
if (pattern == null) {
    return false;
if (pattern.equals(PATTERN_YYYYMMDD) || pattern.equals(PATTERN_YYYY_MM_DD)) {
    return true;
return false;
...
booleanisNowDay(String d)
is Now Day
boolean flg = false;
SimpleDateFormat sd = new SimpleDateFormat(DATE_FORMAT);
String nowDate = sd.format(new Date());
try {
    d = sd.format(sd.parse(d));
    if (d.equals(nowDate)) {
        flg = true;
} catch (ParseException e) {
    e.printStackTrace();
return flg;
BooleanisSomeDay(String date)
is Some Day
String today = date2Str(new Date(), "yyyy-MM-dd");
return date.equals(today);
ListlastDays(int count)
last Days
List<String> strings = new ArrayList<String>();
Calendar day = Calendar.getInstance();
for (int i = 0; i < count; i++) {
    day.add(Calendar.DATE, -1);
    strings.add(df.format(day.getTime()));
return strings;
Stringlong2StringPerDay(long t, SimpleDateFormat sdf)
long String Per Day
return sdf.format(new Date(t));
longminDayToLong(String time)
min Day To Long
return new SimpleDateFormat("yyyy-MM-ddZ").parse(time).getTime();