The list of methods to do Second Format are organized into topic(s).
Float
_toSeconds(String strTime) to Seconds
Float time = 0F;
try {
if (strTime.endsWith("s")) {
time = Float.parseFloat(strTime.replace("s", "")) * 1;
} else if (strTime.endsWith("m")) {
time = Float.parseFloat(strTime.replace("m", "")) * 60;
} else if (strTime.endsWith("h")) {
time = Float.parseFloat(strTime.replace("h", "")) * 60 * 60;
...
long[]
changeSecondsToTime(long seconds) change Seconds To Time
long hour = seconds / 3600;
long minute = (seconds - hour * 3600) / 60;
long second = (seconds - hour * 3600 - minute * 60);
return new long[] { hour, minute, second };
String
formatMiliSeconds(long time) Format time interval for humans
long hours, minutes, seconds, mseconds;
mseconds = time % 1000;
time = time / 1000;
hours = time / 3600;
time = time - (hours * 3600);
minutes = time / 60;
time = time - (minutes * 60);
seconds = time;
...
String
formatMilliIntervalAsSeconds(long interval) Format a millisecond interval as number of seconds (with fracitonal part).
long seconds = interval / 1000;
long millis = interval - seconds * 1000;
StringBuilder buff = new StringBuilder();
buff.append(seconds).append(".");
buff.append(millis).append("s");
return buff.toString();