public static String dateFormatFromMilliSecond(long seconds) {
// 初始化format格式
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
// 設置時區,跳過此步驟會默認設置爲"GMT+08:00" 得到的結果會多出來8個小時
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+00:00"));
String time = dateFormat.format(seconds);
return time;
}
例如,輸入2000的話,輸出結果: 00:00:02