📜  秒到小时 java 代码示例

📅  最后修改于: 2022-03-11 14:52:19.100000             🧑  作者: Mango

代码示例1
int s=123456;
            int sec = s % 60;
            int min = (s / 60)%60;
            int hours = (s/60)/60;
            
            String strSec=(sec<10)?"0"+Integer.toString(sec):Integer.toString(sec);
            String strmin=(min<10)?"0"+Integer.toString(min):Integer.toString(min);
            String strHours=(hours<10)?"0"+Integer.toString(hours):Integer.toString(hours);
            
            System.out.println(strHours + ":" + strmin + ":" + strSec);