List of utility methods to do Timestamp Create
String | getTimestamp(Date date, String timestampPattern) get Timestamp if (date != null && timestampPattern != null) { SimpleDateFormat formatter = new SimpleDateFormat(timestampPattern); return formatter.format(date); return date != null ? date.toString() : null; |
String | getTimestamp(Date time) Converts a time to timestamp format. return getTimestampFormatter().format(time == null ? new Date() : time); |
long | getTimestamp(final File file) get Timestamp final long modified = file.lastModified(); return Long.parseLong(timestamp(modified)); |
Timestamp | getTimestamp(final LocalDate date) get Timestamp return date != null ? Timestamp.valueOf(date.atStartOfDay()) : null;
|
Timestamp | getTimestamp(final Map, ?> map, final Object key) get Timestamp return getTimestamp(map, key, null);
|
String | getTimestamp(int offset) get Timestamp Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, offset); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); return formatter.format(cal.getTime()); |
Timestamp | getTimestamp(int year, int month, int day, int hour, int min, int second) get Timestamp Calendar calendar = Calendar.getInstance(); calendar.set(year, month - 1, day, hour, min, second); return new Timestamp(calendar.getTimeInMillis()); |
java.sql.Timestamp | getTimestamp(java.util.Date utilDate) converts a java.util.Date to java.sql.Timestamp return new java.sql.Timestamp(utilDate.getTime()); |
java.sql.Timestamp | getTimestamp(long time) Convert a millisecond value to a Timestamp. return new java.sql.Timestamp(time); |
Timestamp | getTimestamp(Object o) get Timestamp Timestamp sh = null; if (null == o) return sh; if (o instanceof Date) { sh = (Timestamp) o; return sh; |