Class DurationUtils


  • public class DurationUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      DurationUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int parse​(java.lang.String durationString)
      Parses a human readable duration string and calculates the number of seconds it represents.
      static java.lang.String toString​(int durationSeconds)
      Create a human readable duration string from seconds.
      static java.lang.String toString​(int durationSeconds, boolean includeMonths)
      Create a human readable duration string from seconds.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DurationUtils

        public DurationUtils()
    • Method Detail

      • toString

        public static final java.lang.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 java.lang.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​(java.lang.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