Package play.libs

Class Time


  • public class Time
    extends Object
    Time utilities.
    • Constructor Detail

      • Time

        public Time()
    • Method Detail

      • parseDuration

        public static int parseDuration​(String duration)
        Parses a duration.
        Parameters:
        duration - a quantity of time, such as 3h, 2mn, 7s
        Returns:
        the length of the duration in seconds
      • parseCRONExpression

        public static Date parseCRONExpression​(String cron)
        Parses a CRON expression.
        Parameters:
        cron - the CRON String
        Returns:
        the next Date that satisfies the expression
      • cronInterval

        public static long cronInterval​(String cron)
        Computes the number of milliseconds between the next valid date and the one after.
        Parameters:
        cron - the CRON String
        Returns:
        the number of milliseconds between the next valid date and the one after, with an invalid interval between
      • cronInterval

        public static long cronInterval​(String cron,
                                        Date date)
        Compute the number of milliseconds between the next valid date and the one after.
        Parameters:
        cron - the CRON String
        date - the date to start search
        Returns:
        the number of milliseconds between the next valid date and the one after, with an invalid interval between