Java Long Number to Time convertTime(long x)

Here you can find the source of convertTime(long x)

Description

Takes a time in milliseconds and converts to a string to be printed.

License

Open Source License

Parameter

Parameter Description
x The time to be formatted, in milliseconds (as a long).

Return

A string to be printed.

Declaration

public static String convertTime(long x) 

Method Source Code

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

public class Main {
    /** /*from w  w w.j  a v a2s .  c o  m*/
     * Takes a time in milliseconds and converts to a string to be printed.
     * 
     * @param x The time to be formatted, in milliseconds (as a long).
     * @return A string to be printed.
     */
    public static String convertTime(long x) {
        x /= 1000;
        return String.format("%dh%02dm%02ds", x / 3600, (x / 60) % 60, x % 60);
    }
}

Related

  1. convertTime(Long time)
  2. convertTime(long time)
  3. convertTime(long time)
  4. convertTime(long time)
  5. convertTime(long value)
  6. convertTimestampToSec(long timestampInMs)
  7. convertTimestampToUTCString(final long aTimestamp)
  8. convertTimeToInt(long seconds)
  9. convertTimeToString(final long time)