List of utility methods to do Time Format
String | formatTime(long ms) format Time long secs = ms / 1000; long min = secs / 60; secs = secs % 60; ms = ms % 1000; if (min > 0) { return min + " minutes " + secs + " seconds " + ms + " ms"; return secs + " seconds " + ms + " ms"; ... |
String | formatTime(long msElapsed) Format elasped time if (msElapsed < 60000) { return msElapsed / 1000 + " sec"; } else if (msElapsed < 60000 * 60) { return msElapsed / 60000 + " min " + (msElapsed % 60000) / 1000 + " sec"; return ""; |
String | formatTime(Long num) format Time if (num <= 0) return "never"; String str = ""; num = num / 1000; if (num >= 60 * 60 * 24) { int d = (int) (num / (60 * 60 * 24)); str += d + "d"; num = num - (d * 60 * 60 * 24); ... |
String | formatTime(long sec) format Time long days = sec / (3600 * 24); sec -= days * 3600 * 24; long hours = sec / 3600; sec -= hours * 3600; long mins = sec / 60; sec -= mins * 60; long secs = sec; return String.format("%sd %sh %sm %ss", days, hours, mins, secs); ... |
String | formatTime(long seconds) format Time StringBuffer rv = new StringBuffer(); if (seconds < 60) { return seconds + " seconds"; if (seconds < (60 * 60)) { return (seconds / 60) + " minutes"; if (seconds < (60 * 60 * 24)) { ... |
String | formatTime(long seconds) Format elapsed time as [[h+]:[mm]]:ss. StringBuilder buffer = new StringBuilder(8); if (seconds < 0) { buffer.append('-'); seconds *= -1; long hours = seconds / 3600; if (hours > 0) { if (hours > 9999) ... |
String | formatTime(long seconds) format Time String timeText = ""; seconds += 1L; if (seconds % (60 * 60 * 24 * 365) >= 0) { int timecalc = (int) Math.floor(seconds / (60 * 60 * 24 * 365)); seconds = seconds % (60 * 60 * 24 * 365); if (timecalc != 0) { if (timecalc == 1) { timeText += timecalc + " year,"; ... |
String | formatTime(long time) Formatea el tiempo en milisegundos devolviendo un String en formato . int days = 0; int hours = 0; int minuts = 0; int seconds = (int) (time / 1000D); if (seconds >= 60) { minuts = (seconds / 60); seconds = (seconds - (minuts * 60)); if (minuts >= 60) { ... |
String | formatTime(long time) format Time if (time <= 0) { return "now"; } else if (time < TIME_SECOND) { return time + "ms"; } else if (time < TIME_MINUTE) { return (time / TIME_SECOND) + "s"; } else if (time < TIME_HOUR) { return (time / TIME_MINUTE) + "m " + formatTime(time % TIME_MINUTE); ... |
String | formatTime(long time) Formats the given time to a string based on it's size.
int steps = 0; while (time >= 1000) { time /= 1000; steps++; return time + getTimeUnit(steps); |