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

StringformatTimestamp(Date timestamp)
format Timestamp
return yyyyMMddFormatter.get().format(timestamp);
StringformatTimestamp(Date timestamp)
format Timestamp
DateFormat format = new SimpleDateFormat(DATE_TIME_FORMAT);
format.setCalendar(new GregorianCalendar(UTC));
return format.format(timestamp);
StringformatTimestamp(final Date date)
format Timestamp
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
StringformatTimestamp(final Long timestamp)
Formats the given timestamp using the following pattern:'yyyy-MM-dd HH:mm:ss'.
final SimpleDateFormat dateTimeFormat = new SimpleDateFormat(TSTP);
dateTimeFormat.setTimeZone(TimeZone.getDefault());
return timestamp != null ? dateTimeFormat.format(new Date(timestamp * UNIX_TSTP)) : "";
StringformatTimeStamp(long epochTime)
Return a readable formatted version of the given epoch time.
return TIME_FORMAT.format(new Date(epochTime));
StringformatTimestamp(Long mills)
format Timestamp
return formatTimestamp(new Date(mills));
StringformatTimestamp(long timestamp)
format Timestamp
Date date = new Date(timestamp);
String formatString = "dd.MM.YY HH:mm:ss.S";
SimpleDateFormat formatter = new SimpleDateFormat(formatString);
return formatter.format(date);
StringformatTimestamp(long timestamp)
format Timestamp
if (timestamp <= 0)
    return null;
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
return (sdf.format(new Date(timestamp)));
StringformatTimestamp(long timestamp)
format Timestamp
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
return sdf.format(new Date(timestamp));
StringformatTimestamp(long timestamp)
format Timestamp
DateFormat dtf = new SimpleDateFormat("HH:mm:ss");
dtf.setTimeZone(TimeZone.getDefault());
return dtf.format(new Date(timestamp));