Java Second Convert convertSecondsToTime(int totalSecs)

Here you can find the source of convertSecondsToTime(int totalSecs)

Description

convert Seconds To Time

License

Apache License

Declaration

public static String convertSecondsToTime(int totalSecs) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String convertSecondsToTime(int totalSecs) {
        int hours = totalSecs / 3600;
        int minutes = (totalSecs % 3600) / 60;
        int seconds = totalSecs % 60;

        return (hours < 10 ? "0" : "") + hours + ":" + (minutes < 10 ? "0" : "") + minutes + ":"
                + (seconds < 10 ? "0" : "") + seconds;
    }/*from   w  w  w .  ja v  a2  s  .co m*/
}

Related

  1. convertSecondsToMiliseconds(double seconds)
  2. convertSecondsToMiliseconds(int secondsToConvert)
  3. convertSecondsToMillies(final long seconds)
  4. convertSecondsToString(double seconds)
  5. convertSecondsToTime(int seconds)
  6. convertSecondsToTimecode(float totalSeconds)
  7. convertSecondsToTimeUnits(int seconds)
  8. convertTimecodeToSeconds(String timecode)
  9. convertTimemilisecondsToHours(long time)