Java Duration Format formatSeconds(Duration duration)

Here you can find the source of formatSeconds(Duration duration)

Description

format Seconds

License

Apache License

Declaration

public static String formatSeconds(Duration duration) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.DecimalFormat;

import java.time.Duration;

public class Main {
    private static final DecimalFormat SECONDS_FORMAT = new DecimalFormat("0.000s");

    public static String formatSeconds(Duration duration) {
        return SECONDS_FORMAT.format(duration.toMillis() / 1000d);
    }/* w ww.  ja  v  a2  s.  c  om*/
}

Related

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