List of utility methods to do Date Get
int | getDayOfWeek(String year, String month, String day) get Day Of Week Calendar cal = new GregorianCalendar(Integer.valueOf(year) .intValue(), Integer.valueOf(month).intValue() - 1, Integer .valueOf(day).intValue()); return cal.get(Calendar.DAY_OF_WEEK); |
int | getDayofWeekInMonth(String year, String month, String weekOfMonth, String dayOfWeek) get Dayof Week In Month Calendar cal = new GregorianCalendar(); int y = Integer.valueOf(year).intValue(); int m = Integer.valueOf(month).intValue(); cal.clear(); cal.set(y, m - 1, 1); cal.set(Calendar.DAY_OF_WEEK_IN_MONTH, Integer.valueOf(weekOfMonth) .intValue()); cal.set(Calendar.DAY_OF_WEEK, Integer.valueOf(dayOfWeek).intValue()); ... |
int | getDaysOfCurMonth() get Days Of Cur Month int curyear = Integer.valueOf(getCurrentYear()).intValue(); int curMonth = Integer.valueOf(getCurrentMonth()).intValue(); int mArray[] = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if ((curyear % 400 == 0) || ((curyear % 100 != 0) && (curyear % 4 == 0))) { mArray[1] = 29; return mArray[curMonth - 1]; |
int | getDaysOfCurMonth(final String time) get Days Of Cur Month if (time.length() != 7) { throw new NullPointerException("yyyy-MM"); String[] timeArray = time.split("-"); int curyear = Integer.valueOf(timeArray[0]).intValue(); int curMonth = Integer.valueOf(timeArray[1]).intValue(); if (curMonth > 12) { throw new NullPointerException("null pointer "); ... |
int | getMonth(Date date) get Month if (null == date) { throw new IllegalArgumentException("The date is null"); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.MONTH); |
long | getTomorrowAtEight() get Tomorrow At Eight Calendar calendar = Calendar.getInstance();
stripTime(calendar);
calendar.set(Calendar.HOUR_OF_DAY, 8);
calendar.add(Calendar.DAY_OF_MONTH, 1);
return calendar.getTime().getTime();
|
int | getWeekOfDate(Date dt) get Week Of Date Calendar cal = Calendar.getInstance(); cal.setTime(dt); int w = cal.get(Calendar.DAY_OF_WEEK); return w; |
int | getYear(Date date) get Year Calendar calendar = new GregorianCalendar(); calendar.setTime(date); return calendar.get(Calendar.YEAR); |
Date | getDateObj() get Date Obj Calendar c = new GregorianCalendar(); return c.getTime(); |
Date | getDate(int year, int month, int date, int hourOfDay, int minute, int second) get Date Calendar cal = new GregorianCalendar(); cal.set(year, month, date, hourOfDay, minute, second); return cal.getTime(); |