List of utility methods to do Timestamp
Calendar | sqlDateToCalendar(Timestamp date) Converts the given SQL Date to a Calendar. if (date == null) { return null; } else { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(date); return gc; |
Date | SQLTimestampToDate(java.sql.Timestamp ts) Convert a java.sql.timestamp into a java.util.date Date date = new Date(ts.getTime()); return date; |
java.util.Date | sqlTimestampToDate(Timestamp t) sql Timestamp To Date return t != null ? new java.util.Date(Math.round(t.getTime() + t.getNanos() / 1000000D)) : null; |
String | StrToDateTimeFormat(String timestampStr, String pattern) Str To Date Time Format String s = ""; try { s = String.valueOf(StrToTimestamp(timestampStr, pattern)); s = s.substring(0, pattern.length()); } catch (Exception e) { return s; |
Timestamp | strToTimestamp(String date) str To Timestamp Date day = strToDate(date); return new Timestamp(day.getTime()); |
Timestamp | strToTimestamp(String dateStr) str To Timestamp return Timestamp.valueOf(dateStr);
|
Timestamp | strToTimestamp(String i_Today, String i_Hour, String i_Minute) str To Timestamp try { if (i_Today == null || i_Hour == null || i_Minute == null) { return null; java.util.Date d = strToDate(i_Today, i_Hour, i_Minute); return new java.sql.Timestamp(d.getTime()); } catch (Exception e) { return null; |
Timestamp | StrToTimestamp(String timestampStr, String pattern) Str To Timestamp java.util.Date date = null; SimpleDateFormat format = new SimpleDateFormat(pattern); try { date = format.parse(timestampStr); } catch (ParseException ex) { throw ex; return date == null ? null : new Timestamp(date.getTime()); ... |
Timestamp | timestamp() timestamp return new Timestamp(DateTime.now().getMillis()); |
Timestamp | timestamp(int year, int month, int day, int hour, int minute, int second, int nanosecond) timestamp Timestamp result = new Timestamp(millis(year, month, day, hour, minute, second)); result.setNanos(nanosecond); return result; |