Java Millisecond Convert millisecondsToString(long milliseconds)

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

Description

Converts the given milliseconds to string.

License

Open Source License

Parameter

Parameter Description
milliseconds time to be converted

Return

string

Declaration

public static String millisecondsToString(long milliseconds) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w ww . j a  v a 2s . co  m*/
     * Converts the given milliseconds to string.
     *
     * @param milliseconds time to be converted
     * @return string
     */
    public static String millisecondsToString(long milliseconds) {
        int seconds = (int) (milliseconds / 1000) % 60;
        int minutes = (int) ((milliseconds / (1000 * 60)) % 60);
        int hours = (int) ((milliseconds / (1000 * 60 * 60)) % 24);
        return hours + " h " + minutes + " min " + seconds + " s";
    }
}

Related

  1. millisecondsToHumanTime(long period)
  2. millisecondsToNanoseconds(Long milliseconds)
  3. millisecondsToSeconds(long ms)
  4. millisecondsToSecondsString(long millis)
  5. milliSecondsToString(long interval)
  6. millisecondsToString(long time)
  7. millisecondsToTimerString(long millis)
  8. millisecondsToTimestamp(final long milliseconds)
  9. millisecondsToTimeString(int milliseconds)