Java Utililty Methods Timestamp Format

List of utility methods to do Timestamp Format

Description

The list of methods to do Timestamp Format are organized into topic(s).

Method

StringtoReadableTime(Long timestamp, String format)
to Readable Time
SimpleDateFormat sdf = new SimpleDateFormat(format);
sdf.setTimeZone(TimeZone.getDefault());
if (timestamp == null)
    timestamp = System.currentTimeMillis();
return sdf.format(new Date(timestamp));
longtoTimeStamp(String dateTime, SimpleDateFormat format, int timeZoneOffset)
Convert a string to a time stamp using the same algorithm as the Aerospike loader.
Date formatDate = format.parse(dateTime);
long miliSecondForDate = formatDate.getTime() - timeZoneOffset;
return miliSecondForDate / 1000;
LongunixTimestamp(String date, String dateFormat)
unix Timestamp
return new Long(parseDate(date, dateFormat).getTime() / 1000);