Package com.pnfsoftware.jeb.util.format
Class TimeFormatter
java.lang.Object
com.pnfsoftware.jeb.util.format.TimeFormatter
Utility methods to format timestamps and time deltas.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatTimestamp
(long unixTimestampMs) Format an epoch timestamp as a UTC string using the following format:static String
formatTimestamp
(long unixTimestampMs, String timezone) Format an epoch timestamp as using the following format:static String
formatTimestampDelta
(long deltaMs) Format a time delta or time duration as a human-readable string.static String
formatTimestampLocal
(long unixTimestampMs) Format an epoch timestamp as a local, system specific date-and-time string.
-
Constructor Details
-
TimeFormatter
public TimeFormatter()
-
-
Method Details
-
formatTimestamp
Format an epoch timestamp as a UTC string using the following format:YYYY/MM/DD-hh:mm:ss
- Parameters:
unixTimestampMs
- Unix epoch timestamp in milliseconds- Returns:
-
formatTimestamp
Format an epoch timestamp as using the following format:YYYY/MM/DD-hh:mm:ss
- Parameters:
unixTimestampMs
- Unix epoch timestamp in milliseconds- Returns:
-
formatTimestampLocal
Format an epoch timestamp as a local, system specific date-and-time string.- Parameters:
unixTimestampMs
- Unix epoch timestamp in milliseconds- Returns:
-
formatTimestampDelta
Format a time delta or time duration as a human-readable string. The reported duration usess, m, h, d
for seconds, minutes, hours, and days.- Parameters:
deltaMs
- delta or duration in milliseconds; it may be negative- Returns:
- the formatted rounded delta
-