List of utility methods to do Millisecond Format
String | formatMilliseconds(final long ms) format Milliseconds return formatNanoseconds(ms * 1_000_000L);
|
String | formatMilliseconds(Double milliseconds) Formats milliseconds in m:ss format milliseconds /= 1000; return String.format("%01.0f:%02.0f", milliseconds / 60, milliseconds % 60); |
String | formatMilliseconds(long milliseconds) Format milliseconds into a more readable format. long millis = Math.round(milliseconds / (double) 1000); StringBuffer niceString = new StringBuffer(); if (millis > 60 * 60) { niceString.append(millis / (60 * 60) + "h"); millis %= (60 * 60); if (millis > 60) { niceString.append(millis / (60) + "m"); ... |
String | formatMilliseconds(long milliseconds) format Milliseconds long seconds = milliseconds / 1000; if (seconds < 60) { return "" + seconds + " second" + s(seconds); long minutes = seconds / 60; seconds = seconds % 60; if (minutes < 60) { return "" + minutes + " minute" + s(minutes) + " " + seconds + " second" + s(seconds); ... |
String | formatMilliSecondsHumanReadable(long x) format Milli Seconds Human Readable @SuppressWarnings("unused") long millis = 0; long seconds = 0; long minutes = 0; long hours = 0; long days = 0; seconds = (int) (x / 1000); millis = x % 1000; ... |
String | formatMillisecondsToConventional(long duration, int unitCount) Convert milliseconds value to a human-readable duration of mixed units, using units no larger than days. if (unitCount <= 0) { unitCount = 5; if (duration == 0) { return "0ms"; StringBuffer sb = new StringBuffer(); if (duration < 0) { ... |
String | formatMillisecondsToConventional(long time) Convert milliseconds value to a human-readable duration return formatMillisecondsToConventional(time, true);
|
String | formatMillisTime(long millis) format Millis Time return millisTime.get().format(new Date(millis)); |
String | formatMillisTimeGMT(long millis) format Millis Time GMT Date d = new Date(millis); synchronized (GMT_FORMAT_MILLIS) { return GMT_FORMAT_MILLIS.format(d); |
String | formatSystemTime(long millis) format System Time Date date = new Date(millis); return DateFormat.getInstance().format(date); |