Java Utililty Methods Day

List of utility methods to do Day

Description

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

Method

StringgetLastDay()
get Last Day
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
Date theDate = calendar.getTime();
String s = df.format(theDate);
StringBuffer str = new StringBuffer().append(s).append(" 23:59:59");
return str.toString();
DategetLastDay(Date date)
get Last Day
Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.DAY_OF_MONTH, 1);
c.roll(Calendar.DATE, false);
return c.getTime();
DategetLastDay(Date date)
get Last Day
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int value = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, value);
return cal.getTime();
intgetLastDay(Date date)
get Last Day
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1);
calendar.roll(Calendar.DATE, -1);
Date time = calendar.getTime();
String format = dayParse.format(time);
String[] split = format.split("-");
String day = split[2];
...
StringgetLastDay(String nowdate, String inFormat, String outFormat)
get Last Day
String returndate = "";
Date date = getDateFromString(nowdate, inFormat);
Calendar cl = Calendar.getInstance();
cl.setTime(date);
switch (cl.get(2)) {
case 0:
    cl.set(5, 31);
    break;
...
DategetLastDayOfQuarter(Date date)
get Last Day Of Quarter
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return getLastDayOfQuarter(calendar.get(Calendar.YEAR), getQuarterOfYear(date));
MapgetLastNDays(int aInN)
get Last N Days
HashMap<String, GregorianCalendar> lDays = new HashMap<String, GregorianCalendar>();
GregorianCalendar lCal = (GregorianCalendar) GregorianCalendar.getInstance();
while (aInN > 0) {
    updateCalenderDate(lCal);
    String lFormattedDate = getFormattedDate(lCal);
    lDays.put(lFormattedDate, lCal);
    aInN--;
    lCal = (GregorianCalendar) lCal.clone();
...
DategetLastTimeInDay(Date day)
get Last Time In Day
Calendar date = Calendar.getInstance();
date.setTime(getFirstTimeInDay(day));
date.add(Calendar.DAY_OF_YEAR, 1);
date.add(Calendar.SECOND, -1);
return date.getTime();