代码:
public static void main(String[] args) { //秒 转 时分秒 long srcSecs = 2370; long hours = srcSecs / 3600; long mins = (srcSecs % 3600) / 60; long secs = srcSecs % 60; //转 时分秒 System.out.println("时分秒 " + hours + ":" + mins + ":" + secs); }
运行结果:
2023-10-15 21:22:28
代码:
public static void main(String[] args) { //秒 转 时分秒 long srcSecs = 2370; long hours = srcSecs / 3600; long mins = (srcSecs % 3600) / 60; long secs = srcSecs % 60; //转 时分秒 System.out.println("时分秒 " + hours + ":" + mins + ":" + secs); }
运行结果: