List of utility methods to do Month of Year
Date | getTimeByYMD(int year, int month, int day) get Time By YMD Calendar calendar = Calendar.getInstance();
calendar.set(year, month - 1, day);
return calendar.getTime();
|
Date | getTimestamp(int year, int month, int day, int hour, int minute, int second, int millisecond) get Timestamp Calendar cal = Calendar.getInstance();
cal.clear();
setDate(cal, year, month, day);
setTime(cal, hour, minute, second);
cal.set(Calendar.MILLISECOND, millisecond);
return cal.getTime();
|
String | getTodayAdd(int year, int month, int day) get Today Add String tmpstr = ""; GregorianCalendar calendar = new GregorianCalendar(); int yearnow = calendar.get(Calendar.YEAR) + year; int monthnow = calendar.get(Calendar.MONTH) + month; int daynow = calendar.get(Calendar.DAY_OF_MONTH) + day; tmpstr += yearnow + "-"; if (monthnow < 10) { tmpstr += "0" + monthnow + "-"; ... |
int | getWeek(int year, int month, int day) get Week Calendar c = new GregorianCalendar(); c.set(year, month - 1, day); return c.get(Calendar.DAY_OF_WEEK); |
Map | getWorkDayNum(int year, int month, int start, int end) get Work Day Num Map<Integer, Integer> map = new HashMap<Integer, Integer>(); if (start != end) { for (int i = start; i <= end; i++) { Calendar c = Calendar.getInstance(); c.set(year, month - 1, i); if (1 == c.get(Calendar.DAY_OF_WEEK)) { Integer value = map.get(1) == null ? 0 : map.get(1); map.put(1, value + 1); ... |
boolean | isDefaultHolidays(int year, int month, int day) is Default Holidays GregorianCalendar cal = new GregorianCalendar(year, month - 1, day); int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK); return dayOfWeek == Calendar.SUNDAY || dayOfWeek == Calendar.SATURDAY; |
boolean | isWeekEnd(int year, int month, int day) is Week End int dayOfWeek = getDayOfWeek(year, month, day); if (Calendar.SATURDAY == dayOfWeek || Calendar.SUNDAY == dayOfWeek) { return true; } else { return false; |
String | Month_Of_Year(String Date, int MonthCase) Mont O Year int MonthNo; MonthNo = atoi(Date.substring(0, 2)); StringBuffer moy = new StringBuffer(MOY[MonthNo - 1]); if (MonthCase < 4) moy = new StringBuffer(moy.substring(0, 3)); switch (MonthCase) { case 1: case 4: ... |
int | monthLength(int month, int year) month Length if (month != Calendar.FEBRUARY) return MONTH_LENGTHS[month]; return (isLeapYear(year) ? 29 : 28); |
Date | newInstance(int year, int month, int day) new Instance return newInstance(year, month, day, 0, 0, 0, 0);
|