List of utility methods to do Month Day
Date | getCurrMonthFirstDay() get Curr Month First Day Calendar calendar = Calendar.getInstance(); Date d = new Date(); calendar.setTime(d); calendar.set(Calendar.DATE, 1); return calendar.getTime(); |
int | getDayOfMonth() get Day Of Month Calendar calendar = Calendar.getInstance();
return calendar.get(Calendar.DAY_OF_MONTH);
|
int | getDaysInMonth(final Date date) Returns the number of days in the month given a date final GregorianCalendar c = gregorianCalendarThreadLocal.get(); c.setTime(date); c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.getActualMaximum(Calendar.DAY_OF_MONTH)); return c.get(Calendar.DAY_OF_MONTH); |
int | getDaysOfMonth(Date date) get Days Of Month calendar.setTime(date);
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
int | getDaysOfMonth(Date date) get Days Of Month Calendar c = Calendar.getInstance();
c.setTime(date);
return c.getActualMaximum(5);
|
String | getFirstDate(String base_month) get First Date SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); ParsePosition pos1 = new ParsePosition(0); base_month = base_month + "01"; java.util.Date FirstDate = sdf.parse(base_month, pos1); return String.valueOf(sdf.format(FirstDate)); |
String | getFirstDateOfCurMonth() get First Date Of Cur Month String curYearMonth = getCurYearMonth(); return curYearMonth + "-01"; |
Date | getFirstDateOfMonth(Date theDate) get First Date Of Month Calendar c = new GregorianCalendar(); c.setTime(theDate); c.set(Calendar.DAY_OF_MONTH, 1); 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(); ... |
Date | getFirstday_Month(Date date, int months) get Firstda Month SimpleDateFormat df = new SimpleDateFormat(webFormat);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.MONTH, months);
Date theDate = calendar.getTime();
GregorianCalendar gcLast = (GregorianCalendar) Calendar.getInstance();
gcLast.setTime(theDate);
gcLast.set(Calendar.DAY_OF_MONTH, 1);
...
|
String | getFirstDayOfCurMonth() get First Day Of Cur Month Calendar calendar = new GregorianCalendar(); calendar.set(Calendar.DATE, 1); SimpleDateFormat simpleFormate = new SimpleDateFormat("yyyy-MM-dd"); return simpleFormate.format(calendar.getTime()).trim(); |