Java Milli Second to Minute millsecondsToMinutesAndSeconds(long milliseconds)

Here you can find the source of millsecondsToMinutesAndSeconds(long milliseconds)

Description

millseconds To Minutes And Seconds

License

Open Source License

Declaration

public static String millsecondsToMinutesAndSeconds(long milliseconds) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License"); you may

public class Main {
    private final static long MINUTE = 60;

    public static String millsecondsToMinutesAndSeconds(long milliseconds) {
        String result = milliseconds > 0 ? "" : "0:00";
        long totalSeconds = milliseconds / 1000;

        long minutes = totalSeconds / MINUTE;
        long seconds = (totalSeconds % MINUTE);
        result += minutes;/*from   www .j a  v a2s.co  m*/
        result += ":";
        if (seconds < 10)
            result += "0";
        result += seconds;
        return result;
    }
}

Related

  1. millisToMinutes(double millis)
  2. millisToMinutes(final long milliseconds)
  3. millisToMinutes(long millis)
  4. milliToHourMinuteString(long millis)
  5. milliToMinutes(long millis)
  6. minuteMillis()
  7. setMinutes(long millis)