hours min sec java code example
Example: seconds to hours java
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);