List of utility methods to do Month Day
String | getStringOfFirstDayInMonth() get String Of First Day In Month Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); String temp = sdf.format(date); String firstDayInMoth = ""; firstDayInMoth = temp + "-01"; return firstDayInMoth; |
boolean | isFirstDayOfMonth() is First Day Of Month Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.DAY_OF_MONTH) == 1;
|
boolean | isLastDayOfMonth() Checking the date of the end of Month try { Date today = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(today); calendar.add(Calendar.MONTH, 1); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.DATE, -1); Date lastDayOfMonth = calendar.getTime(); ... |
boolean | isLastDayOfMonth(Calendar cal) is Last Day Of Month int m1 = cal.get(Calendar.MONTH); cal.add(Calendar.DAY_OF_MONTH, 1); int m2 = cal.get(Calendar.MONTH); cal.add(Calendar.DAY_OF_MONTH, -1); return m1 != m2; |
String | lastDayOfLastMonth() last Day Of Last Month Calendar cal = Calendar.getInstance();
cal.set(Calendar.DATE, 1);
cal.add(Calendar.DATE, -1);
return String.valueOf(dfDdMMMYYYY.format(cal.getTime()));
|
String | lastdayofmonth() lastdayofmonth Calendar calendar = Calendar.getInstance(); Calendar cpcalendar = (Calendar) calendar.clone(); cpcalendar.set(Calendar.DAY_OF_MONTH, 1); cpcalendar.add(Calendar.MONTH, 1); cpcalendar.add(Calendar.DATE, -1); String date = yyyyMMdd.format(new Date(cpcalendar.getTimeInMillis())); return date; |
String | lastDayOfMonth(String batdate) last Day Of Month Calendar cal = Calendar.getInstance(); Date date = null; try { date = new SimpleDateFormat("yyyyMMdd").parse(batdate); } catch (ParseException e) { e.printStackTrace(); cal.setTime(date); ... |
String | lastDayOfMonth(String src) last Day Of Month return lastDayOfMonth(src, "yyyyMMdd"); |
String | previousMonthFirstDay() previous Month First Day SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN); Date curDate = new Date(System.currentTimeMillis()); Calendar calendar = Calendar.getInstance(); calendar.setTime(curDate); calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) - 1); calendar.set(Calendar.DAY_OF_MONTH, 1); return sdf.format(calendar.getTime()); |