List of utility methods to do Day of Month
Date | getFirstDayOfMonth(Date date) get First Day Of Month Calendar calender = Calendar.getInstance();
calender.setTime(date);
calender.set(Calendar.DAY_OF_MONTH, calender.getActualMinimum(Calendar.DAY_OF_MONTH));
setStartTimeOfDay(calender);
return calender.getTime();
|
Date | getFirstDayOfMonth(Date date) get First Day Of Month Calendar result = Calendar.getInstance(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, date.getYear() + 1900); calendar.set(Calendar.MONTH, date.getMonth()); calendar.set(Calendar.DATE, date.getDate()); result.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DATE)); result.set(Calendar.MONTH, calendar.get(Calendar.MONTH)); result.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); ... |
java.util.Date | getFirstDayOfMonth(java.util.Date date) getFirstDayOfMonth: returns the first day of the given dates month date = truncateToDay(date); if (date != null) { java.util.Calendar c = java.util.Calendar.getInstance(Locale.GERMANY); c.setTime(date); c.set(Calendar.DAY_OF_MONTH, 1); return c.getTime(); } else { return null; ... |
Date | getFirstMiddleDayOfMonth(Date date) get First Middle Day Of Month Calendar todayCalendar = Calendar.getInstance();
todayCalendar.setTime(date);
Calendar firstMiddleDayOfmonthCalendar = Calendar.getInstance();
firstMiddleDayOfmonthCalendar.set(todayCalendar.get(Calendar.YEAR), todayCalendar.get(Calendar.MONTH), 16,
0, 0, 0);
return firstMiddleDayOfmonthCalendar.getTime();
|
Integer | getFistDayOfMonth(Date date) get Fist Day Of Month Integer intDate = getIntDate(date); int year = intDate / 10000; int month = intDate % 10000 / 100; return getIntDate(newCalendar(year, month, 1)); |
Date | getFromDate(boolean invoiceSearchFromFirstDayOfMonth) get From Date if (invoiceSearchFromFirstDayOfMonth) { Calendar calendar = Calendar.getInstance(); int month = calendar.get(Calendar.MONTH); calendar.set(Calendar.MONTH, month - 6); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); ... |
String | getLastDateOfCurMonth() get Last Date Of Cur Month String curYearMonth = getCurYearMonth(); Calendar calendar = Calendar.getInstance(); int maxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); return curYearMonth + "-" + maxDay; |
int | getLastDay(int year, int month) get Last Day int day = 0; switch (month) { case 1: case 3: case 5: case 7: case 8: case 10: ... |
String | getLastDayByMonthWeek(int year, int month, int week) get Last Day By Month Week DateFormat df = new SimpleDateFormat("yyyy-MM-dd "); Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, year); c.set(Calendar.MONTH, month - 1); c.set(Calendar.WEEK_OF_MONTH, week); int firstDayofweek = c.getFirstDayOfWeek(); int lastDayofweek = firstDayofweek + 6; Calendar c2 = Calendar.getInstance(); ... |
int | getLastDayInMonth(int year, int month) get Last Day In Month int lLastDay = -1; switch (month) { case 0: case 2: case 4: case 6: case 7: case 9: ... |