List of utility methods to do Timestamp Parse
Date | parseTimestamp(String s) parse Timestamp if (s == null) return null; return dfDateTime_mmddyyyy.parse(s); |
Timestamp | parseTimestamp(String sDate, String sFormat) parse Timestamp java.text.SimpleDateFormat formatter = null; java.util.Date utildate = null; formatter = new java.text.SimpleDateFormat(sFormat); utildate = formatter.parse(sDate); java.sql.Timestamp tsdate = new java.sql.Timestamp(utildate.getTime()); return tsdate; |
Timestamp | parseTimestamp(String src, String pattern) parse Timestamp Date date = parseDate(src, pattern); return new Timestamp(date.getTime()); |
Timestamp | parseTimestamp(String strDate) parse Timestamp try { Timestamp result = Timestamp.valueOf(strDate); return result; } catch (Exception pe) { return null; |
boolean | parseTimestamp(String time) Parse the time StringBuilder dateFormat = new StringBuilder("yyyy-MM-dd'T'HH:mm:ss"); int fromIndex = time.lastIndexOf(':'); if (time.indexOf('+', fromIndex) > 0 || time.indexOf('-', fromIndex) > 0) { dateFormat.append('Z'); try { Date date = new SimpleDateFormat(dateFormat.toString()).parse(time); long ms = date.getTime(); ... |
Date | parseTimestamp(String timestamp) Parses a timestamp string in YYYY-MM-dd HH:mm:ss GMT format. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); df.setTimeZone(TimeZone.getTimeZone("GMT")); try { return df.parse(timestamp); } catch (ParseException e) { e.printStackTrace(); return new Date(); |
Calendar | parseTimeStamp(String timeStamp) parse Time Stamp return parseDateTime(timeStamp, FORMAT_TIMESTAMP);
|
Date | parseTimestamp(String timestamp) parse Timestamp TimeZone tz = TimeZone.getTimeZone("America/Chicago"); DateFormat sdf = new SimpleDateFormat("yyyyMMdd h:m:s"); sdf.setTimeZone(tz); return sdf.parse(timestamp); |
Date | parseTimestamp(String timestamp) parse Timestamp int length = timestamp.length(); DateFormat format = null; if (length == LONG_FORMAT_LENGTH) { format = new SimpleDateFormat(DATE_TIME_FORMAT); } else if (length == SHORT_FORMAT_LENGTH) { format = new SimpleDateFormat(DATE_FORMAT); } else { throw new ParseException("timestamp has unexpected format: '" + timestamp + "'", 0); ... |
long | parseTimeStamp(String timeStamp) parse Time Stamp SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss"); Date date; try { date = format.parse(timeStamp); } catch (ParseException e) { SimpleDateFormat optFormat = new SimpleDateFormat("yy-MM-dd HH:mm"); date = optFormat.parse(timeStamp); return date.getTime(); |