Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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);
 
PREVIOUS NEXT
Tagged: #seconds #hours #java
ADD COMMENT
Topic
Name
4+6 =