Java Utililty Methods Day From

List of utility methods to do Day From

Description

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

Method

DategetDateFromDayNum(int dayNum)
get Date From Day Num
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.set(Calendar.DAY_OF_MONTH, dayNum);
return calendar.getTime();
DategetDateUpDay(Date d)
get Date Up Day
if (d != null) {
    Calendar a = Calendar.getInstance();
    a.setTime(d);
    a.add(Calendar.DATE, +1);
    d = a.getTime();
return (d);
intgetDay(Date date)
get Day
return getDatePar(Calendar.DAY_OF_MONTH, date);
DategetDay(Date date)
Gets a date with on the date portion
Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
return c.getTime();
DategetDay(Date date, int day)
get Day
long currDateMills = date.getTime();
long extraMills = day * 3600 * 1000 * 24;
Calendar result = Calendar.getInstance();
result.setTimeInMillis(currDateMills + extraMills);
return result.getTime();
intgetDay(String date)
get Day
date = deleteSlash(date);
date = deleteDash(date);
return Integer.parseInt(date.substring(6, 8));
DategetDay0(Date date)
get Day
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
intgetDayOfDate(Date date)
get Day Of Date
Calendar c = Calendar.getInstance();
c.setTime(date);
return c.get(Calendar.DATE);
intgetDays(Date date1, Date date2)
get Days
Long days = date1.getTime() - date2.getTime();
return (int) (days / 1000 / 3600 / 24);
intgetDays(Date sd, Date ed)
get Days
return (int) ((ed.getTime() - sd.getTime()) / (3600 * 24 * 1000));