List of utility methods to do Second Convert
String | secondsToTimecode(long seconds) seconds To Timecode long hours = 0; long mins = 0; long secs = 0; hours = seconds / 3600L; seconds -= (hours * 3600); mins = seconds / 60L; secs = seconds - (mins * 60L); String result = String.format(":%02d", Long.valueOf(secs)); ... |
String | secondsToTimeDisplay(Object value) Converts a long into a string that represents the music time. String timeDisplay = ""; if (value instanceof Long) { long valueLong = (Long) value; long hours = valueLong / 3600; long minutes = (valueLong - (hours * 3600)) / 60; long seconds = (valueLong - (hours * 3600) - (minutes * 60)); if (hours != 0) { if (hours < 10) { ... |
CharSequence | secondsToTimeString(int numSeconds) Converts an integer into the format "(mm:ss)". int hours = numSeconds / 3600; int minutes = (numSeconds - (hours * 3600)) / 60; int seconds = Math.max(0, numSeconds - (hours * 3600) - (minutes * 60)); return (hours > 0 ? String.format("%2s", hours).replace(' ', '0') + ":" : "") + String.format("%2s", minutes).replace(' ', '0') + ":" + String.format("%2s", seconds).replace(' ', '0'); |
String | secondsToTimeString(long in_seconds) seconds To Time String StringBuilder buff = new StringBuilder(9); if (in_seconds < 0) { buff.append('-'); in_seconds = -in_seconds; long rest = in_seconds; long hour = rest / 3600; rest = rest % 3600; ... |
String | secondsToTimeString(long seconds) Converts seconds into h:mm:ss. String result = ""; if (seconds >= 3600) { result += seconds / 3600 + ":"; seconds = seconds % 3600; if (seconds >= 60) { long temp = seconds / 60; result += (temp < 10 ? "0" : "") + temp + ":"; ... |
String | secondsToYWDHMS(long seconds) Converti un nombre de secondes en duree (annees/semaines/jours/heures/min/sec). if (seconds < 0) { return "-1"; StringBuffer sb = new StringBuffer(); double _seconds = (double) seconds; double oneyear = 31536000d; double _years = _seconds / oneyear; double years = Math.floor(_years); ... |
double | SecondToMin(double asec) Second To Min double min = 0; double sec = 0; min = (int) (asec / 60); sec = (int) (asec % 60); return min + (sec / 100); |
int | timeStringToSeconds(String str) time String To Seconds try { StringTokenizer tokenizer = new StringTokenizer(str, ":"); int h = Integer.parseInt(tokenizer.nextToken()); int m = Integer.parseInt(tokenizer.nextToken()); int s = 0; if (tokenizer.hasMoreTokens()) { s = Integer.parseInt(tokenizer.nextToken()); return h * 3600 + m * 60 + s; } catch (Exception e) { throw new ParseException(str, 0); |
int | toCentiSeconds(float t) to Centi Seconds return (int) (t / 10); |
String | toDaySecondDifference(long difference) to Day Second Difference difference *= difference > 0 ? .001 : -.001; if (difference == 0) { return "0 seconds"; StringBuilder ret = new StringBuilder(); difference = append(ret, difference, 60 * 60 * 24, "day"); difference = append(ret, difference, 60 * 60, "hour"); difference = append(ret, difference, 60, "minute"); ... |