Java examples for java.util:Time
This method will format the time given in milliseconds to a string in the 00:00 format
//package com.java2s; import java.util.Locale; import java.util.concurrent.TimeUnit; public class Main { /** This method will format the time given in milliseconds to a string in the 00:00 format */ public static String formatMillisecond(long milliseconds) { return String.format( Locale.getDefault(), "%02d:%02d", TimeUnit.MILLISECONDS.toMinutes(milliseconds) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS .toHours(milliseconds)), TimeUnit.MILLISECONDS.toSeconds(milliseconds) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS .toMinutes(milliseconds))); }/*from www. j a v a 2s . c om*/ }