Java Second Convert secondsToHours(int s)

Here you can find the source of secondsToHours(int s)

Description

seconds To Hours

License

Open Source License

Declaration

public static String secondsToHours(int s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String secondsToHours(int s) {
        int h = s / 3600;
        int q = s % 3600;
        int m = q / 60;
        int ss = q % 60;
        return align(h) + ":" + align(m) + ":" + align(ss);
    }// w  w  w .j av  a  2 s .  c o m

    private static String align(int i) {
        String s = String.valueOf(i);
        if (s.length() == 0) {
            return "00" + s;
        }
        if (s.length() == 1) {
            return "0" + s;
        }
        return s;
    }
}

Related

  1. secondsToCycles(double secs, double hz)
  2. secondsToHHMMSS(int secs)
  3. secondsToHHMMSS(long secs)
  4. secondsToHour(int time)
  5. secondsToHours(double seconds)
  6. secondsToInternal(int seconds)
  7. secondsToNanoseconds(long seconds)
  8. secondsToReadableBiggest(int seconds)
  9. secondsToString(int seconds)