Java Minute Format toReadableMinutes(long time)

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

Description

Converts a time format in long form to a human-readable minute value

License

Open Source License

Parameter

Parameter Description
time the time to be converted

Return

the human-readable minute value

Declaration

public static String toReadableMinutes(long time) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from w w  w .  j  av a  2s  .  co m*/
     * Converts a time format in long form to a human-readable minute value
     * @param time the time to be converted
     * @return the human-readable minute value
     */
    public static String toReadableMinutes(long time) {
        if (time > 3600) {
            return String.format("%d:%02d:%02d", time / 3600, (time % 3600) / 60, (time % 60));
        } else {
            return String.format("%d:%02d", (time % 3600) / 60, (time % 60));
        }
    }
}

Related

  1. formatMinutes(long time, String timerPrecisionId, boolean round)
  2. formatMinutes(long timeMinutes)
  3. formatSecondsToMinutes(int secontsTotal)
  4. formatTimeInMinutes(long l)
  5. getFormattedHoursAndMinutes(final long millis)