Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

PREVIOUS NEXT
Code Example
Java :: The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path 
Java :: java convert bytes to string 
Java :: how to format a datetime object to show date and time and milliseconds in java 
Java :: flutter Uri toString and String to Uri 
Java :: javafx tableview remove clear all data 
Java :: java for loop high to low 
Java :: message box in javafx 
Java :: string to double java exception 
Java :: java file dialog 
Java :: how to set checkbox size in android 
Java :: java create a set with values 
Java :: java get files in directory 
Java :: calculate prime factors of a number java 
Java :: java close jframe 
Java :: servlet redirect java 
Java :: set fontcolor of jframe 
Java :: bukkit runnable repeating scheduler 
Java :: cannot lock java compile cache as it has already been locked by this process 
Java :: how to deselect radio button in java 
Java :: update value in hashmap java 
Java :: java jtextfield text bold 
Java :: how to clear stringbuilder in java 
Java :: clsoe keyboard android studio 
Java :: maven compiler plugin for java 13 
Java :: how to change a bukkit chat format 
Java :: java int to hex fixed length 
Java :: How to efficiently find a target element in a sorted matrix of distinct ints, in Java? 
Java :: java create set with values 
Java :: java remove equal element of a list 
Java :: spring data rest partial update 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =