Mega Code Archive

 
Categories / Android / Date Type
 

Return the time in ms into format MM

class TimerFormatter {   public static final String TIME_SEPARATOR = ":";      /**    * Return the time in ms into format MM:SS    * @param timeInMs    * @return format MM:SS    */   public static String formatMsToFormattedTime(long timeInMs) {     long minutes = Math.abs(timeInMs / 60000);     long seconds = (timeInMs - (minutes * 60000)) /1000;     return String.format("%02d",minutes) + TIME_SEPARATOR + String.format("%02d",seconds);   }    }