Here you can find the source of secondsToString(int seconds)
Parameter | Description |
---|---|
time | a parameter |
fmt | a parameter |
static public String secondsToString(int seconds)
//package com.java2s; //License from project: Apache License public class Main { /**//www . java 2 s . c o m * @param time * @param fmt */ static public String secondsToString(int seconds) { int h = seconds / (60 * 60); int m = seconds / 60 % 60; int s = seconds % 60; return toStr2(h) + ":" + toStr2(m) + (s == 0 ? "" : ":" + toStr2(s)); } final static private String toStr2(int x) { return x < 10 ? "0" + x : "" + x; } }