Java TimeUnit Usage formatMs(long millis)

Here you can find the source of formatMs(long millis)

Description

format Ms

License

Open Source License

Declaration

public static String formatMs(long millis) 

Method Source Code


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

import java.util.concurrent.TimeUnit;

public class Main {
    public static String formatMs(long millis) {
        return String.format("%02d:%02d:%02d.%03d", TimeUnit.MILLISECONDS.toHours(millis),
                TimeUnit.MILLISECONDS.toMinutes(millis) % TimeUnit.HOURS.toMinutes(1),
                TimeUnit.MILLISECONDS.toSeconds(millis) % TimeUnit.MINUTES.toSeconds(1), millis % 1000);
    }//from w w  w. ja  v  a2  s.  co  m
}

Related

  1. formatMillis(final long millis)
  2. formatMillis(long millis)
  3. formatMillis(long millis)
  4. formatMillisecs(long lMillisecs, final boolean bWantMSecs)
  5. formatMillisIntoMinutesAndSeconds(long millis)
  6. formatSeconds(int seconds)
  7. formatTime(long time)
  8. formatTime(long time)
  9. formatTime(long timeInNanoseconds)