List of utility methods to do Month Day
String | getFirstDayOfCurrentMonth() get First Day Of Current Month Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, 1); return new SimpleDateFormat("yyyy-MM-dd ").format(cal.getTime()); |
String | getFirstDayOfLastMonth() get First Day Of Last Month SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.MONTH, -1); cal.set(Calendar.DAY_OF_MONTH, 1); return format.format(cal.getTime()); |
Date | getfirstDayOfMonth() getfirst Day Of Month Date date = new Date(); SimpleDateFormat format = new SimpleDateFormat(YYYYMMDD); Calendar sCal = Calendar.getInstance(); sCal.setTime(date); sCal.add(Calendar.DAY_OF_MONTH, -(sCal.get(Calendar.DAY_OF_MONTH) - 1)); try { date = format.parse(format.format(sCal.getTime())); } catch (ParseException e) { ... |
Date | getFirstDayOfMonth(Calendar c) get First Day Of Month int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH); int day = 1; c.set(year, month, day, 0, 0, 0); return c.getTime(); |
String | getFirstDayOfMonth(Date date) get First Day Of Month Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DATE));
return date2String(cal.getTime());
|
Date | getFirstDayOfMonth(Date date) get First Day Of Month if (null == date) return null; return parserDate(getFirstDayStringOfMonth(date), format2); |
Date | getFirstDayOfMonth(Date date) get First Day Of Month Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1);
return calendar.getTime();
|
Date | getFirstDayOfMonth(Date date) get First Day Of Month Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1);
return calendar.getTime();
|
Date | getFirstDayOfMonth(Date date) get First Day Of Month Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.DAY_OF_MONTH, 1);
return startOfDay(calendar.getTime());
|
Long | getFirstDayOfMonth(Long date) get First Day Of Month Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.clear(Calendar.MINUTE);
cal.clear(Calendar.SECOND);
cal.clear(Calendar.MILLISECOND);
cal.set(Calendar.DAY_OF_MONTH, Calendar.getInstance().getActualMinimum(Calendar.DAY_OF_MONTH));
return cal.getTimeInMillis();
...
|