Java Long Number to Time getDuration(long time)

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

Description

get Duration

License

Apache License

Declaration

public static String getDuration(long time) 

Method Source Code

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

import java.text.NumberFormat;

public class Main {
    public static String getDuration(long time) {
        NumberFormat f = NumberFormat.getInstance();
        f.setMinimumIntegerDigits(2);//  w ww  .j a v  a2 s. co  m
        int milliseconds = (int) (time % 1000);
        time /= 1000;
        int seconds = (int) time % 60;
        time /= 60;
        int minutes = (int) time % 60;
        time /= 60;
        int hours = (int) time;
        String result = f.format(hours) + ":" + f.format(minutes) + ":" + f.format(seconds);
        f.setMinimumIntegerDigits(3);
        result += ":" + f.format(milliseconds);
        return result;
    }
}

Related

  1. formatXSDateTime(long lastModified)
  2. getAmPm(long time)
  3. getCollectTimeInLong(Date date)
  4. getDelay(long delay, long interval)
  5. getDT(long mills)
  6. getElapsedTime(long start, long end)
  7. getElapsedTime(long startTime, long finishTime)
  8. getElapsedTimeSpecificationDescription(long sizeInBytes)
  9. getExpires(long maxAge)