List of utility methods to do Second to Minute
String | secondsToHoursMinutesSeconds(final long secs) Converts seconds into hours:minutes:seconds. final double minutesRemaining = (secs / 60) % 60; final double hoursRemaining = Math.floor(secs / 60 / 60); final double secondsRemaining = secs % 60; final StringBuilder sb = new StringBuilder(); if (hoursRemaining > 0.0) { sb.append((int) hoursRemaining); sb.append(" hrs, "); if (minutesRemaining > 0.0) { sb.append((int) minutesRemaining); sb.append(" mins, "); sb.append((int) secondsRemaining); sb.append(" secs"); return sb.toString(); |
String | secondsToMinutes(int s) seconds To Minutes int m = s / 60; int ss = s % 60; return align(m) + ":" + align(ss); |
String | secondsToMinutes(int seconds) Converts seconds into minutes int ms = seconds / 60; int ss = seconds % 60; String m = (ms < 10 ? "0" : "") + ms; String s = (ss < 10 ? "0" : "") + ss; return m + ":" + s; |
int | secondsToMinutes(int seconds) seconds To Minutes if (seconds == 0) { return 0; } else { int minutes = seconds / 60; if (seconds % 60 > 0) { minutes += 1; return minutes; ... |
String | secondsToMinutes(int time) seconds To Minutes if (time < 0) return null; int minutes = (time / 60) % 60; String minutesStr = (minutes < 10 ? "0" : "") + minutes; return minutesStr; |
int | timeToMinute(String time) time To Minute int mark = time.indexOf(':'); if (mark > 0) { int hour = Integer.parseInt(time.substring(0, mark)); if (hour == 12) { hour = 0; String mins = time.substring(mark + 1, time.length() - 1); int minute = Integer.parseInt(mins); ... |
int | timeToMinutes(String in) Convert a time String to a time code in minutes int mins; if (in.length() == 8 && in.charAt(2) == ':' && in.charAt(5) == ':') { mins = (in.charAt(0) & 0xF) * 600 + (in.charAt(1) & 0xF) * 60 + (in.charAt(3) & 0xF) * 10 + (in.charAt(4) & 0xF); } else { mins = 0; return mins; ... |
String | toDecimal(long seconds, int nanoseconds) to Decimal StringBuilder sb = new StringBuilder(20).append(seconds).append('.'); if (nanoseconds == 0L) { if (seconds == 0L) { return "0.0"; sb.append("000000000"); } else { StringBuilder nanoSB = new StringBuilder(9); ... |
String | toDecimal(long seconds, int nanoseconds) to Decimal StringBuilder string = new StringBuilder(Integer.toString(nanoseconds)); if (string.length() < 9) string.insert(0, ZEROES, 0, 9 - string.length()); return seconds + "." + string; |
int | toMinutes(int hour, int minutes) to Minutes hour = (hour < 0) ? 0 : hour;
minutes = (minutes < 0) ? 0 : minutes;
return ((hour * 60) + minutes);
|