Java Duration Format formatShortDuration(long ms)

Here you can find the source of formatShortDuration(long ms)

Description

format Short Duration

License

Open Source License

Declaration

public static String formatShortDuration(long ms) 

Method Source Code

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

public class Main {
    private static long HOUR_TO_MILLISEC = 3600000;
    private static long MIN_TO_MILLISEC = 60000;

    public static String formatShortDuration(long ms) {
        long hour = ms / HOUR_TO_MILLISEC;
        long min = (ms - hour * HOUR_TO_MILLISEC) / MIN_TO_MILLISEC;
        return String.format("%sh %sm", hour, min);
    }/*  www .j  a v a  2 s  .  com*/
}

Related

  1. formatHuman(Duration duration)
  2. formatISO8601Duration(int[] t)
  3. formatNanoDuration(final long nanos)
  4. formatPeriod(final Period period, final boolean wrapInDurationFunction)
  5. formatSeconds(Duration duration)
  6. formattedStringToDuration(final String formattedDuration)
  7. formatTime(long duration)
  8. formatTime(long duration)
  9. formatTimeDuration(long timeDuration)