Class DurationUtils


  • public class DurationUtils
    extends Object
    • Constructor Detail

      • DurationUtils

        public DurationUtils()
    • Method Detail

      • toString

        public static final String toString​(int durationSeconds)
        Create a human readable duration string from seconds.
        Parameters:
        durationSeconds - the total number of seconds in the duration
        Returns:
        a human readable string representing the duration
      • toString

        public static final String toString​(int durationSeconds,
                                            boolean includeMonths)
        Create a human readable duration string from seconds.
        Parameters:
        durationSeconds - the total number of seconds in the duration
        includeMonths - when true will include months "mo", in the string otherwise uses "4w" for each month
        Returns:
        a human readable string representing the duration
      • parse

        public static final int parse​(String durationString)
        Parses a human readable duration string and calculates the number of seconds it represents.
        Parameters:
        durationString - the human readable duration
        Returns:
        the total number of seconds in the duration