List of utility methods to do Second Convert
double | secondsToHours(double seconds) seconds To Hours return seconds / 3600.0;
|
String | secondsToHours(int s) seconds To Hours int h = s / 3600; int q = s % 3600; int m = q / 60; int ss = q % 60; return align(h) + ":" + align(m) + ":" + align(ss); |
int | secondsToInternal(int seconds) Helper method that converts from seconds into internal time unit (which is approximately "quarter of a second") if (seconds < MAX_SECONDS_FOR_INT) { return (seconds * 1000) >>> 8; long msecs = 1000L * seconds; return (int) (msecs >>> 8); |
long | secondsToNanoseconds(long seconds) seconds To Nanoseconds return seconds * 1000000000;
|
String | secondsToReadableBiggest(int seconds) Changes the amount of seconds to its biggest part More then an hour returns "xx hour" Less then an hour but more then a minute returns "xx min" Otherwise returns "xx sec" if (seconds > 60 * 60) return Math.round(seconds / (60 * 60)) + " hour"; else if (seconds > 60) return Math.round(seconds / 60) + " min"; else return seconds + " sec"; |
String | secondsToString(int seconds) seconds To String int h = seconds / (60 * 60); int m = seconds / 60 % 60; int s = seconds % 60; return toStr2(h) + ":" + toStr2(m) + (s == 0 ? "" : ":" + toStr2(s)); |
String | secondsToString(long seconds) seconds To String long h = seconds / 3600; long m = (seconds - (h * 3600)) / 60; long s = seconds - (h * 3600) - (m * 60); return String.format("%02d:%02d:%02d", h, m, s); |
String | SecondsToString(long seconds) Formats number of seconds to a string consists of number of seconds, minutes, hours or days and the corresponding entity (e.g. String timeString = null; if (seconds < 60) { timeString = seconds + " seconds"; } else if (seconds < 3600) { timeString = (seconds / 60) + " minutes"; } else if (seconds < 86400) { timeString = (seconds / 3600) + " hours"; } else { ... |
String | secondsToString(long seconds) Converts seconds from long to a String in the format "mm:ss". if (seconds < 0) { seconds = seconds * -1; return String.format("%02d:%02d", seconds / 60, seconds % 60); |
String | secondsToString(long time) seconds To String return millisecondsToString(time * 1000);
|