Class DurationFormats


  • public class DurationFormats
    extends Object
    Factory methods for DurationFormat instances.
    • Method Detail

      • getUsDefaultInstance

        public static DurationFormat getUsDefaultInstance()
        DurationFormat for US locales, using units from nanoseconds up to years, without fractions.

        Examples:

        • 60 seconds -> "1m"
        • 3601 seconds: -> "1h 1s"
        • 8 days -> "1w 1d"
        • 8 days -> "1w 1d"
        Returns:
        An instance that will format values in a form appropriate for the US locale.
      • usShortSuffixProvider

        public static UnitSuffixProvider usShortSuffixProvider()
        Get a UnitSuffixProvider that provides abbreviated US suffixes such as "µs" for microseconds and "m" for minutes. Suffixes are included for units from nanoseconds through years, not including ChronoUnit.HALF_DAYS.
        Returns:
        The UnitSuffixProvider for short US suffixes.