List of utility methods to do Timestamp Field
String | getDateString(java.sql.Timestamp ts) get Date String if (ts == null) { return ""; return Timestamp2DDMMYYYY(ts); |
String | getDateString(Timestamp time, String pattern) get Date String DateFormat dfmt = new SimpleDateFormat(pattern); Date date = time; return date != null ? dfmt.format(date) : ""; |
String | getDateTime(Timestamp argRenDt) This method converts timestamp to the specified datetime format String strDate = null; if (argRenDt != null) { SimpleDateFormat dtFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); strDate = dtFormat.format(argRenDt); return strDate; |
DateTime | getDateTime(Timestamp timestamp) get Date Time return new DateTime(timestamp, GJChronology.getInstance(DateTimeZone.UTC)); |
String | getDateTimeFromSqlTimestamp(Timestamp timestamp) get Date Time From Sql Timestamp if (timestamp != null) { return timestamp.toString().substring(0, 19); return ""; |
DateTime | getDateTimeFromTimeStamp(Timestamp timestamp) get Date Time From Time Stamp return new DateTime(timestamp.getTime(), DateTimeZone.UTC); |
Date | getDateTimestamp(ResultSet rs, String columnLabel) get Date Timestamp Timestamp timestamp = rs.getTimestamp(columnLabel); if (timestamp == null) { return null; } else { return new Date(timestamp.getTime()); |
String | getDateTimeStr(Timestamp timestamp) get Date Time Str if (timestamp == null) { return null; Calendar cal = Calendar.getInstance(); cal.setTime(timestamp); return cal.get(Calendar.DAY_OF_MONTH) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR) + " " + getFixedTwoStr(cal.get(Calendar.HOUR_OF_DAY)) + ":" + getFixedTwoStr(cal.get(Calendar.MINUTE)); ... |
String | getDateTimeString(java.sql.Timestamp ts) get Date Time String if (ts == null) { return ""; return Timestamp2DDMMYYYY(ts) + " " + Timestamp2HHMMSS(ts, 1); |
Timestamp | getDayBorder(Timestamp dateTime, Timestamp timeSlot, boolean end) Returns the day border by combining the date part from dateTime and time part form timeSlot. GregorianCalendar gc = new GregorianCalendar(); gc.setTimeInMillis(dateTime.getTime()); dateTime.setNanos(0); if (timeSlot != null) { timeSlot.setNanos(0); GregorianCalendar gcTS = new GregorianCalendar(); gcTS.setTimeInMillis(timeSlot.getTime()); gc.set(Calendar.HOUR_OF_DAY, gcTS.get(Calendar.HOUR_OF_DAY)); ... |