List of utility methods to do Timestamp Create
Timestamp | getTimestampNullSafe(final Date ts) get Timestamp Null Safe return (ts == null) ? null : new Timestamp(ts.getTime()); |
Timestamp | getTimestampOrNull(Object dbResult) Convenience method to format dbResult if (dbResult == null) { return null; return (Timestamp) dbResult; |
String | getTimeStampString() get Time Stamp String Date date = new Date(); timestamp = DateFormat.getDateTimeInstance().format(date); return timestamp; |
String | getTimestampString(long timeInMillis) get Timestamp String Timestamp ts = new Timestamp(timeInMillis); String tsStr = ts.toString().substring(0, 19) + "-0" + ts.getTimezoneOffset() / 60 + "00"; return tsStr; |
String | getTimeStampStringFormat(Timestamp ts, String fmt) get Time Stamp String Format String result = ""; LinkedList<String> fmtList = new LinkedList<String>(); LinkedList<String> valList = new LinkedList<String>(); fmtList.clear(); valList.clear(); result = ts.toString(); fmtList.add("yyyy"); valList.add(result.substring(0, 4)); ... |
String | getTimestampToOracle() get Timestamp To Oracle SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sdf.format(System.currentTimeMillis()); |
Timestamp | getTimestampXDaysFromY(long startTimeInMillis, int daysFromStartDate) get Timestamp X Days From Y Calendar cal = getCalendarXDaysFromY(startTimeInMillis, daysFromStartDate); return new Timestamp(cal.getTimeInMillis()); |
String | getTimeStrByTimestamp(long timestamp, String tz) get Time Str By Timestamp Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(timestamp); SimpleDateFormat dateFormatGmt = new SimpleDateFormat(DATE_FORMAT); dateFormatGmt.setTimeZone(TimeZone.getTimeZone(tz)); return dateFormatGmt.format(calendar.getTime()); |
long | timestamp() timestamp return timestampStartOfDay(System.currentTimeMillis());
|
long | timeStamp() time Stamp return System.currentTimeMillis();
|