Java Duration Format formatDuration(long t_millis)

Here you can find the source of formatDuration(long t_millis)

Description

format Duration

License

Open Source License

Declaration

public static String formatDuration(long t_millis) 

Method Source Code

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

public class Main {
    public static String formatDuration(long t_millis) {
        long t_seconds = (t_millis / (1000)) % 60;
        long t_minutes = (t_millis / (1000 * 60)) % 60;
        long t_hours = (t_millis / (1000 * 60 * 60)) % 24;
        long t_days = (t_millis / (1000 * 60 * 60 * 24));
        return t_days + "d " + t_hours + "h " + t_minutes + "m " + t_seconds + "s";
    }// w w  w  .  j a va 2s .c o m
}

Related

  1. formatDuration(long ms)
  2. formatDuration(long ms)
  3. formatDuration(long number)
  4. formatDuration(long seconds)
  5. formatDuration(long seconds)
  6. formatDuration(long timeInMillis)
  7. formatDurationAsTime(final int duration)
  8. formatDurationHMSms(long ms)
  9. formatDurationLpad(final String s)