List of utility methods to do SQL Date Month
Object | getFirstDayOfNextMonth(Date date, boolean isFormatDate) get First Day Of Next Month Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.MONDAY, calendar.get(Calendar.MONTH) + 1); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); if (isFormatDate) return formatDate(getFirstDayOfMonth(calendar.getTime())); ... |
Timestamp | getMinDayInMonth(java.sql.Date date) get Min Day In Month Calendar cale = Calendar.getInstance(); cale.setTime(date); cale.set(Calendar.DAY_OF_MONTH, cale.getActualMinimum(Calendar.DAY_OF_MONTH)); java.sql.Date newDate = new java.sql.Date(cale.getTimeInMillis()); cale = null; return Timestamp.valueOf(newDate.toString() + " 00:00:00.000"); |
Integer | getMonth(Date date) get Month return initCalendar(date).get(Calendar.MONTH) + 1;
|
int | getMonth(final java.sql.Date date) Returns the month of the given date Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.MONTH) + 1;
|
int | getMonthAmount(java.sql.Date _startDate, java.sql.Date _endDate) get Month Amount int nYear = 0; int nMonth = 0; int nDay = 0; int nMonthAmount = 0; Calendar cldStart = Calendar.getInstance(); Calendar cldEnd = Calendar.getInstance(); cldStart.setTime(_startDate); cldEnd.setTime(_endDate); ... |
Date | getMonthBefroe(Date date) get Month Befroe Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.MONTH, -1); Date date2 = new Date(calendar.getTimeInMillis()); return date2; |
java.sql.Date | getMonthDate(Date myDate, int month) Gets the month date. Calendar cal = Calendar.getInstance(); cal.setTime(myDate); cal.add(Calendar.MONTH, month); java.util.Date newDate = cal.getTime(); return new java.sql.Date(newDate.getTime()); |
java.sql.Date[] | getMonthDays(java.sql.Date date) get Month Days Calendar cale = Calendar.getInstance(); cale.setTime(date); int today = cale.get(Calendar.DAY_OF_MONTH); int days = cale.getActualMaximum(Calendar.DAY_OF_MONTH); long millis = cale.getTimeInMillis(); java.sql.Date dates[] = new java.sql.Date[days]; for (int i = 1; i <= days; i++) { long sub = (today - i) * 24 * 60 * 60 * 1000L; ... |
String | getMonthFromYMD(Date ymd) get Month From YMD return getMonthFromYMD(toString(ymd));
|
java.sql.Timestamp | getMonthStart(Date stamp) Return the date for the first day of the month return getMonthStart(stamp, 0);
|