Java Time Format formatTimeToString(long seconds)

Here you can find the source of formatTimeToString(long seconds)

Description

format Time To String

License

Open Source License

Declaration

public static String formatTimeToString(long seconds) 

Method Source Code

//package com.java2s;

public class Main {
    public static String formatTimeToString(long seconds) {
        int hours = (int) (seconds / 3600);
        int remainder = (int) (seconds % 3600);
        int minutes = remainder / 60;
        seconds = remainder % 60;//  w ww . ja va2s.  co  m

        return ((hours < 10 ? "0" : "") + hours + ":" + (minutes < 10 ? "0" : "") + minutes + ":"
                + (seconds < 10 ? "0" : "") + seconds);
    }
}

Related

  1. formatTimeStep(Integer numberOfTimestepsPerYear, int stepNumber)
  2. formatTimeString(long millisecond)
  3. formatTimeString(String time)
  4. formatTimeTakenNs(long startTimeNs, String message)
  5. formatTimeToString(long milisec)
  6. formatTimeUnits(double nanos)
  7. formatTimeZoneID(String id)
  8. formatToTimeStr(String str)
  9. formatUptime(long uptime)