List of utility methods to do SQL Date Get
Date | getDateFromLong(ResultSet resultSet, int index) Gets a Date value from a Long value from a current result set. Long dateIntoLongFormat = getLong(resultSet, index); if (dateIntoLongFormat != null) { return new Date(dateIntoLongFormat); return null; |
Date | getDateFromResultSet(ResultSet rset, Enum field) get Date From Result Set return getDateFromResultSet(rset, field.name());
|
Date | getDateFromRTGSDateString(String iobDate) get Date From RTGS Date String Date date = null; try { int year = Integer.parseInt(iobDate.substring(0, 4)); int month = Integer.parseInt(iobDate.substring(4, 6)); int day = Integer.parseInt(iobDate.substring(6, 8)); date = new Date(year - 1900, month - 1, day); } catch (Exception e) { throw new RuntimeException(e); ... |
Date | getDateFromTimestamp(Timestamp timestamp) get Date From Timestamp if (timestamp == null) return null; return new Date(timestamp.getTime()); |
String | getDateFromYMD(Date ymd) get Date From YMD return getDateFromYMD(toString(ymd));
|
java.sql.Date | getDateInput(String prompt) get Date Input String input = getStringInput(prompt); Date newDate = new SimpleDateFormat("yyyy-MM-dd").parse(input); java.sql.Date SQLDate = new java.sql.Date(newDate.getTime()); return SQLDate; |
java.sql.Date | getDateISO(final String sDate) Return a date instance from a date in ISO format if (sDate == null) { return null; if (sDate.trim().equals("")) { return null; if (sDate.length() != 10) { return null; ... |
java.util.Date | getDateNextMonth(java.util.Date current) get Date Next Month Calendar cal = Calendar.getInstance(); cal.setTime(current); Date retVal = null; if (cal.get(Calendar.MONTH) == Calendar.DECEMBER) { cal.set(Calendar.MONTH, Calendar.JANUARY); } else { cal.set(Calendar.MONTH, cal.get(Calendar.MONTH) + 1); retVal = new Date(cal.getTimeInMillis()); return retVal; |
java.sql.Date | getDateOfShortStr(String dateStr) get Date Of Short Str java.sql.Date da = null; try { da = new java.sql.Date(YYYYMMDD_FORMAT.parse(dateStr).getTime()); } catch (Exception e) { e.printStackTrace(); return da; |
String | getDateOfString(long time, String patten) get Date Of String if (time != 0) { return (new SimpleDateFormat(patten).format(new Date(time))).toString(); return ""; |