Java Second Convert secondsToHHMMSS(int secs)

Here you can find the source of secondsToHHMMSS(int secs)

Description

seconds To HHMMSS

License

Open Source License

Declaration

public static String secondsToHHMMSS(int secs) 

Method Source Code

//package com.java2s;
/**/*from   w ww  .  ja  v  a 2 s  .  c  o  m*/
*    Copyright (c) 2011-2014, OpenIoT
*   
*    This file is part of OpenIoT.
*
*    OpenIoT is free software: you can redistribute it and/or modify
*    it under the terms of the GNU Lesser General Public License as published by
*    the Free Software Foundation, version 3 of the License.
*
*    OpenIoT is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU Lesser General Public License for more details.
*
*    You should have received a copy of the GNU Lesser General Public License
*    along with OpenIoT.  If not, see <http://www.gnu.org/licenses/>.
*
*     Contact: OpenIoT mailto: info@openiot.eu
*/

public class Main {
    public static String secondsToHHMMSS(int secs) {
        String result = "";
        int hours = secs / 3600, remainder = secs % 3600, minutes = remainder / 60, seconds = remainder % 60;
        String disHour = (hours < 10 ? "0" : "") + hours, disMinu = (minutes < 10 ? "0" : "") + minutes,
                disSec = (seconds < 10 ? "0" : "") + seconds;
        result = disHour + ":" + disMinu + ":" + disSec;
        return result;
    }
}

Related

  1. seconds2microseconds(double secs)
  2. seconds2String(long seconds)
  3. seconds2time(long seconds)
  4. seconds2timecents(double seconds)
  5. secondsToCycles(double secs, double hz)
  6. secondsToHHMMSS(long secs)
  7. secondsToHour(int time)
  8. secondsToHours(double seconds)
  9. secondsToHours(int s)