How to convert milli seconds to hours, minutes and seconds in Android? 

Android has a class called TimeUnit, by using this TimeUnit class we can convert Time from one format to other format.

Here we can convert Milliseconds to Hours, Minutes and seconds like below

 

long hours = TimeUnit.MILLISECONDS.toHours(millis); long minutes = TimeUnit.MILLISECONDS.toMinutes(millis); long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);

 

 


Flutter Questions

Android Questions

Python Questions

Java Questions