Java Utililty Methods SQL Date Get

List of utility methods to do SQL Date Get

Description

The list of methods to do SQL Date Get are organized into topic(s).

Method

DategetDateFromLong(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;
DategetDateFromResultSet(ResultSet rset, Enum field)
get Date From Result Set
return getDateFromResultSet(rset, field.name());
DategetDateFromRTGSDateString(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);
...
DategetDateFromTimestamp(Timestamp timestamp)
get Date From Timestamp
if (timestamp == null)
    return null;
return new Date(timestamp.getTime());
StringgetDateFromYMD(Date ymd)
get Date From YMD
return getDateFromYMD(toString(ymd));
java.sql.DategetDateInput(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.DategetDateISO(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.DategetDateNextMonth(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.DategetDateOfShortStr(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;
StringgetDateOfString(long time, String patten)
get Date Of String
if (time != 0) {
    return (new SimpleDateFormat(patten).format(new Date(time))).toString();
return "";