Android Second to Time secsToText(long time)

Here you can find the source of secsToText(long time)

Description

Converts a number of seconds to a String in the format 00:00

License

GNU General Public License

Parameter

Parameter Description
time a time in seconds

Return

the String

Declaration

public static String secsToText(long time) 

Method Source Code

//package com.java2s;
/*//  w  ww. ja  v a  2s  .  c  o m
 * Copyright (C) 2013 Chuan-Zheng Lee
 *
 * This file is part of the Debatekeeper app, which is licensed under the
 * GNU General Public Licence version 3 (GPLv3).  You can redistribute
 * and/or modify it under the terms of the GPLv3, and you must not use
 * this file except in compliance with the GPLv3.
 *
 * This app 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 General Public Licence for more details.
 *
 * You should have received a copy of the GNU General Public Licence
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Locale;

public class Main {
    /**
     * Converts a number of seconds to a String in the format 00:00
     * @param time a time in seconds
     * @return the String
     */
    public static String secsToText(long time) {
        return String.format(Locale.US, "%02d:%02d", time / 60, time % 60);
    }
}

Related

  1. convertSecondsToTimeStamp(int seconds)
  2. calculateDhms(int seconds)
  3. secondsToString(int seconds)
  4. intSecondsToStringMinSec(int input)
  5. getTimeRemaining(long durationInMilliseconds)