List of utility methods to do Timestamp Create
Timestamp | getTimestampFromDateTime(DateTime dateTime) get Timestamp From Date Time TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Timestamp timestamp = null; if (dateTime != null) { timestamp = new Timestamp(dateTime.getMillis()); return timestamp; |
Timestamp | getTimeStampFromISOString(String isoString) get Time Stamp From ISO String Timestamp result; try { Calendar caldate = Calendar.getInstance(); int year = 0; int month = 0; int day = 0; int hour = 0; int min = 0; ... |
java.sql.Timestamp | getTimestampFromString(String dateStr) get Timestamp From String if (dateStr == null || dateStr.equals("")) { return null; SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(dateStr, pos); if (strtodate == null) { strtodate = new Date(); ... |
Timestamp | getTimestampFromString(String dateString, String dateFormat) Trasform a date string into a timestamp SimpleDateFormat format = new SimpleDateFormat(dateFormat); Date parsedDate = format.parse(dateString); Timestamp ts = new Timestamp(parsedDate.getTime()); return ts; |
long | getTimestampFromString(String id) get Timestamp From String String a[] = id.split("-"); return new SimpleDateFormat("yyyyMMddHHmmss").parse(a[1]).getTime() / 1000; |
Timestamp | getTimestampFromString(String s) get Timestamp From String Timestamp result; s = s.trim(); int periodIdx = s.indexOf("."); if (periodIdx != -1) { if (s.length() - periodIdx > 9) { s = s.substring(0, periodIdx + 10); try { result = Timestamp.valueOf(s); } catch (IllegalArgumentException e) { result = null; return result; |
Timestamp | getTimeStampFromString(String timeStamp) get Time Stamp From String return Timestamp.valueOf(timeStamp);
|
String | getTimestampInEnglish(java.sql.Timestamp t) get Timestamp In English if (t == null) return ""; String s = t.toString(); if (s.indexOf(".0") > 0) s = s.substring(0, s.indexOf(".0")); String[] sr = s.split(" "); int month = -1; int day = -1; ... |
String | getTimestampLexical(boolean showSeconds, Locale locale) Gets timestamp lexical. if (showSeconds) return new SimpleDateFormat("yyyyMMddhhmmss", locale).format(new Date()); else return new SimpleDateFormat("yyyyMMddhhmm", locale).format(new Date()); |
Timestamp | getTimestampMinusDays(Integer days) Return a sql timestamp minus for the current day minus the specified days Date d = getDateMinusDays(days); if (d != null) { return new Timestamp(d.getTime()); return null; |