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 StringformatExecutionTime(long exectimeMs) Format an execution time as a human-readable string.static StringformatTimestamp(long unixTimestampMs) Format an epoch timestamp as a UTC string using the following format:static StringformatTimestamp(long unixTimestampMs, String timezone) Format an epoch timestamp as using the following format:static StringformatTimestampDelta(long deltaMs) Format a time delta or time duration as a human-readable string.static StringformatTimestampLocal(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, dfor seconds, minutes, hours, and days.- Parameters:
deltaMs- delta or duration in milliseconds; it may be negative- Returns:
- the formatted rounded delta
-
formatExecutionTime
Format an execution time as a human-readable string. The reported duration usesms, s, m, h, dfor milliseconds, seconds, minutes, hours, and days.- Parameters:
exectimeMs- execution time in milliseconds- Returns:
- the formatted execution time
-