List of utility methods to do Day
String | getLastDay() 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(); |
Date | getLastDay(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();
|
Date | getLastDay(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(); |
int | getLastDay(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];
...
|
String | getLastDay(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; ... |
Date | getLastDayOfQuarter(Date date) get Last Day Of Quarter Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return getLastDayOfQuarter(calendar.get(Calendar.YEAR), getQuarterOfYear(date));
|
Map | getLastNDays(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(); ... |
Date | getLastTimeInDay(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();
|