List of utility methods to do Timestamp Parse
java.sql.Timestamp | parseTimestamp(final String s) parse Timestamp final String[] components = s.split(" "); if (components.length != 2) { throw new IllegalArgumentException("Invalid escape format: " + s); final String[] timeComponents = components[1].split("\\."); if (timeComponents.length != 2) { throw new IllegalArgumentException("Invalid escape format: " + s); } else if (timeComponents[1].length() != 9) { ... |
Timestamp | parseTimeStamp(final String... key) parse Time Stamp final String dateStr = key[0] + "-" + key[1] + "-" + key[2] + " " + key[3] + ":" + key[4] + ":" + key[5]; return new Timestamp(format.parse(dateStr).getTime()); |
String | parseTimestamp(Long time, String pattern) parse Timestamp String dateStr = ""; if (time != 0) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); Date date = new Date(time); dateStr = sdf.format(date); return dateStr; |
long | parseTimestamp(Object o) parse Timestamp String timestamp = o.toString(); SimpleDateFormat sdf; if (timestamp.length() == 8) { sdf = new SimpleDateFormat("HH:mm:ss"); } else if (timestamp.length() == 5) { sdf = new SimpleDateFormat("HH:mm"); } else { return (0L); ... |
Long | parseTimestamp(String d) parse Timestamp if (d == null) { return null; try { return s_dateFormat.parse(d).getTime(); } catch (ParseException e) { throw new RuntimeException(e); |
Date | parseTimestamp(String date) parse Timestamp return getTimetampFormat().parse(date);
|
java.sql.Timestamp | parseTimestamp(String dateStr, String format) parse Timestamp java.util.Date date = parseDate(dateStr, format); if (date != null) { long t = date.getTime(); return new java.sql.Timestamp(t); } else return null; |
Timestamp | parseTimestamp(String dateString) Convert date string to timestamp. Timestamp timestamp = null; try { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS"); Date parsedDate = dateFormat.parse(dateString); timestamp = new Timestamp(parsedDate.getTime()); } catch (Exception e) { e.printStackTrace(); return timestamp; |
java.sql.Timestamp | parseTimestamp(String pattern, String dateTime) parse Timestamp return new java.sql.Timestamp(parseDate(pattern, dateTime).getTime()); |
Timestamp | parseTimestamp(String s) parse Timestamp Timestamp value; if (s.indexOf(':') > 0) { value = Timestamp.valueOf(s); } else if (s.indexOf('.') >= 0) { value = new Timestamp((long) ((double) (Double.parseDouble(s) * 1000))); } else { value = new Timestamp(Long.parseLong(s) * 1000); return value; |