List of utility methods to do Timestamp Parse
Date | parse(java.sql.Timestamp timestamp) parse if (timestamp == null) return null; return new Date(timestamp.getTime() * 1000); |
Date | parseAsCassandraTimestamp(String dateString) parse As Cassandra Timestamp SimpleDateFormat parser = new SimpleDateFormat(); parser.setLenient(false); for (String pattern : CASSANDRA_TS_PATTERNS) { parser.applyPattern(pattern); try { return parser.parse(dateString); } catch (ParseException e) { throw new ParseException("Unable to parse as date [" + dateString + "]", -1); |
Timestamp | parseDateTimeToTimestamp(String string) yyyy-MM-dd HH:mm:ss Timestamp result = null; try { Date date = allDateFmt.parse(string); result = new Timestamp(date.getTime()); } catch (ParseException e) { e.printStackTrace(); return result; ... |
long | parseHeaderDate(String timestamp) Parses a formated date and time string in HTTP-Header date format and returns the time value.
return HEADER_DEFAULT.parse(timestamp).getTime();
|
Date | parseSnapshotTimestamp(final String tstamp) parse Snapshot Timestamp return getFormat().parse(tstamp);
|
Timestamp | parseSQLiteTimestamp(String dd) parse SQ Lite Timestamp try { return new Timestamp(SQLITE_DATE_FMT.parse(dd).getTime()); } catch (Exception e) { return new Timestamp(System.currentTimeMillis()); |
Date | parseStopTime(String timestamp, String timezone) parse Stop Time TimeZone tz = timeZoneForCode(timezone); DateFormat sdf = new SimpleDateFormat("M/d/y H:m:s"); sdf.setTimeZone(tz); return sdf.parse(timestamp); |
java.sql.Timestamp | parseTimestamp(Date date) parse Timestamp if (date == null) return null; long t = date.getTime(); return new java.sql.Timestamp(t); |
Timestamp | parseTimestamp(Date date) parse Timestamp if (date == null) { return null; return new Timestamp(date.getTime()); |
long | parseTimestamp(final String format, final String time) parse Timestamp try { final DateFormat dateFormat = getDateFormat(format); synchronized (dateFormat) { return dateFormat.parse(time).getTime(); } catch (final Exception e) { return 0; |