Android Second Format formatTime(int second)

Here you can find the source of formatTime(int second)

Description

format Time

Declaration

public static String formatTime(int second) 

Method Source Code

//package com.java2s;

public class Main {
    public static String formatTime(int second) {

        int hh = second / 3600;
        int mm = second % 3600 / 60;
        int ss = second % 60;

        if (0 != hh) {
            return String.format("%02d:%02d:%02d", hh, mm, ss);
        } else {//from w  ww .jav a  2  s  .c o  m
            return String.format("%02d:%02d", mm, ss);
        }
    }
}

Related

  1. formatTime(int second)
  2. formatIntoHHMMSS(int secsIn)
  3. getTimeFormattedFromSeconds(int seconds)
  4. formatElapsedTime(long elapsedSeconds)
  5. formatElapsedTime(StringBuilder recycle, long elapsedSeconds)