List of utility methods to do Long Number to Timestamp
long | addSecondsToTimeStamp(Long timestamp, int seconds) add Seconds To Time Stamp Date date = otpDateFormatter.parse(otpDateFormatter.format(timestamp)); calendar.setTime(date); calendar.add(Calendar.SECOND, seconds); long time = calendar.getTimeInMillis(); if (time < timestamp) { calendar.add(Calendar.DAY_OF_YEAR, 1); return calendar.getTimeInMillis(); ... |
String | getCompactStringTimestamp(long timestamp) get Compact String Timestamp SimpleDateFormat sdf = new SimpleDateFormat("MMddHHmmss"); Date tsDate = new Date(timestamp); return sdf.format(tsDate); |
String | getIndex(String index, long timestamp) get Index return index + "-" + indexFormat.format(new Date(timestamp)); |
String | longToDate(long timestamp) long To Date SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd"); Date date1 = new Date(timestamp); return sfd.format(date1); |
String | longToDateTime(long timestamp) Return formatted Date String: yyyy.MM.dd HH:mm:ss Based on Unix's time() input in seconds Date date = new Date(timestamp * 1000); DateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); return formatter.format(date); |
String | longToDateTime(long timestamp) long To Date Time Date date = new Date(timestamp * 1000); DateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss"); return formatter.format(date); |
String | prettyPrintDate(long timestamp) pretty Print Date return sdf.format(new Date(timestamp)); |
String | printTimestamp(Long c) print Timestamp if (c == null) { return null; return s_dateFormat.format(c); |
Long | reverseTimestampToNormalTime(long timestamp) reverse Timestamp To Normal Time Long convert = MAX_TIME - timestamp; try { return new SimpleDateFormat(DATE_FORMAT).parse(Long.toString(convert)).getTime(); } catch (ParseException e) { throw new RuntimeException(e); |
String | timestamp(long time) Supply timestamp to prefix informational messages. return new SimpleDateFormat("HH:mm:ss").format(new Date(time)) + " "; |