List of utility methods to do Timestamp String to Timestamp Convert
Timestamp | str2Timestamp(String str) str Timestamp if (str == null) return null; str = str.trim(); if (!str.matches("^\\d\\d\\d\\d-\\d\\d-\\d\\d$") && !str.matches("^\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d$")) return null; String[] ss = str.split("-| |:"); GregorianCalendar gc = new GregorianCalendar(); ... |
Timestamp | stringConvertTimestamp(String time) string Convert Timestamp if (null == time || "".equals(time)) { return null; if (time.length() == 10) { time = time + " 00:00:00.000000000"; } else if (time.length() == 16) { time = time + ":00.000000000"; } else if (time.length() == 19) { ... |
Date | serverTimestampToDate(String timestamp) server Timestamp To Date try { return new SimpleDateFormat(SERVER_DATE_FORMAT, Locale.GERMANY) .parse(timestamp); } catch (ParseException e) { return new Date(); |