List of utility methods to do Timestamp Create
java.sql.Time | toSqlTime(Timestamp timestamp) to Sql Time return new java.sql.Time(timestamp.getTime()); |
Timestamp | toSqlTimestamp(Date d) to Sql Timestamp return new Timestamp(d.getTime()); |
Timestamp | toSqlTimeStamp(Date d) to Sql Time Stamp if (d == null) return null; return new java.sql.Timestamp(d.getTime()); |
java.sql.Timestamp | toSQLTimestamp(Date date) Convert a java.util.date in a java.sql.timestamp, in order to store the information in a jdbc database java.sql.Timestamp timestamp = new java.sql.Timestamp(date.getTime()); return timestamp; |
java.sql.Timestamp | toSQLTimestamp(DateTime dt) to SQL Timestamp java.sql.Timestamp ts = (dt == null ? null : new java.sql.Timestamp(dt.getMillis())); return ts; |
java.sql.Timestamp | toSqlTimestamp(java.util.Date date) to Sql Timestamp if (date == null) { return null; return toSqlTimestamp(date.getTime()); |
java.sql.Timestamp | toSQLTimestamp(Object object, Object oDefault) to SQL Timestamp if (object == null) { if (oDefault == null) return null; return toSQLTimestamp(oDefault, null); if (object instanceof java.sql.Timestamp) { return (java.sql.Timestamp) object; if (object instanceof java.util.Date) { return new java.sql.Timestamp(((java.util.Date) object).getTime()); if (object instanceof java.util.Calendar) { return new java.sql.Timestamp(((java.util.Calendar) object).getTimeInMillis()); if (object instanceof Long) { return new java.sql.Timestamp(((Long) object).longValue()); if (object instanceof Number) { int iDate = ((Number) object).intValue(); if (iDate < 10000) return toSQLTimestamp(oDefault, null); return new java.sql.Timestamp(intToLongDate(iDate)); if (object instanceof Collection) { return toSQLTimestamp(getFirst(object), oDefault); if (object.getClass().isArray()) { return toSQLTimestamp(getFirst(object), oDefault); if (object instanceof Map) { return toSQLTimestamp(oDefault, null); String sValue = object.toString(); if (sValue == null || sValue.length() == 0) return toSQLTimestamp(oDefault, null); Date time = stringToTime(sValue); if (time == null) return toSQLTimestamp(oDefault, null); return new java.sql.Timestamp(time.getTime()); |
java.sql.Timestamp | toSQLTimestamp(String time) To SQL timestamp. return java.sql.Timestamp.valueOf(time);
|
Timestamp | toTimestamp(BigDecimal value) to Timestamp long seconds = value.longValue(); int nanoseconds = extractNanosecondDecimal(value, seconds); Timestamp ts = new Timestamp(seconds * 1000); ts.setNanos(nanoseconds); return ts; |
Timestamp | toTimestamp(Date date) to Timestamp Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.MILLISECOND, 0); return new Timestamp(calendar.getTimeInMillis()); |