Java Time Readable Format toTimeString(double millis)

Here you can find the source of toTimeString(double millis)

Description

to Time String

License

LGPL

Declaration

public static String toTimeString(double millis) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static String toTimeString(double millis) {
        double display = millis;
        if (display < 1000)
            return display + "ms";
        display /= 1000.0;// ww w  .j ava  2 s. c om
        if (display < 60)
            return String.format("%-2.2f", display) + "s";
        display /= 60;
        if (display < 60)
            return String.format("%-2.2f", display) + "m";
        display /= 60;
        if (display < 24)
            return String.format("%-2.2f", display) + "h";
        return String.format("%-2.2f", display) + "d";

    }
}

Related

  1. toTimeFormat(String _srcTime)
  2. toTimeHumanReadable(final long time)
  3. toTimeSpanDescription(long time)
  4. toTimestamp(long time)
  5. toTimeStampString(String timeStr)
  6. toTimeString(long frame)
  7. toTimeString(long millis)
  8. toTimeString(long millis, boolean showSeconds, String separatorHours, String separatorMin, String separatorSec)
  9. toTimeString(long seconds)