seconds To Hour Minute Seconds - Android java.util

Android examples for java.util:Second

Description

seconds To Hour Minute Seconds

Demo Code


//package com.java2s;

public class Main {
    public static String secToHourMinSec(int iSec) {
        int seconds = iSec;
        int hours = seconds / (60 * 60); // integer/integer = integer
        seconds = seconds % (60 * 60); // modulo (remainder after division)

        int minutes = seconds / 60;
        seconds = seconds % 60;// www.java  2  s  .com

        return String.format("%02d:%02d:%02d", hours, minutes, seconds);
    }
}

Related Tutorials