List of utility methods to do SQL Date
int | getMonthInt(String month) Return month in int representation from String . return Integer.parseInt(month);
|
String | getNextDayStr(String curday) get Next Day Str java.util.Date date = str2utilDate(curday); return date2str(new Date(date.getTime() + 24 * 3600 * 1000)); |
String | getNextDayStr(String curday) get Next Day Str java.util.Date date = str2date(curday); return date2str(new Date(date.getTime() + 24 * 3600 * 1000)); |
java.sql.Date | getNow() Get current date in sql format yyyy-MM-dd Calendar cal = Calendar.getInstance(TimeZone.getDefault()); String DATE_FORMAT = "yyyy-MM-dd"; java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT); sdf.setTimeZone(TimeZone.getDefault()); String now = sdf.format(cal.getTime()); return java.sql.Date.valueOf(now); |
Date | getNow() get Now Calendar cal = Calendar.getInstance(); return new Date(cal.getTimeInMillis()); |
String | getNowHour() get Now Hour String nowHour = ""; try { String strTemp = getNowPlusTimeMill(); nowHour = strTemp.substring(8, 10); return nowHour; } catch (Exception e) { throw e; |
Class extends Object> | getProtobufClass(Object value, Class extends Object> protobufClass) Retrieve the ProtobufClass based on the POJO value. if (value instanceof Integer) { return Integer.TYPE; if (value instanceof Boolean) { return Boolean.TYPE; if (value instanceof Double) { return Double.TYPE; ... |
List | getTodayAndTomorrow() get Today And Tomorrow List<String> dates = new ArrayList<String>(); Calendar cal = Calendar.getInstance(); dates.add(new Date(cal.getTimeInMillis()).toString()); cal.add(Calendar.DATE, 1); dates.add(new Date(cal.getTimeInMillis()).toString()); return dates; |
int | getWeekNumber() Gets the week number. return (getLastSundayDate().get(Calendar.DAY_OF_YEAR)
- getFirstSundayDateInYear(2009).get(Calendar.DAY_OF_YEAR)) / 7 + 1;
|
int | getWeekOfMonth(String year, String month, String day) get Week Of Month java.sql.Date myDate = getDate(year, month, day); int index = 0; try { Calendar cal = Calendar.getInstance(); cal.setTime(myDate); index = cal.get(Calendar.DAY_OF_WEEK); if (index <= 1) { index = 7; ... |