Package play.libs
Class Time
- java.lang.Object
-
- play.libs.Time
-
public class Time extends java.lang.Object
Time utils Provides a parser for time expression.Time expressions provide the ability to specify complex time combinations such as "2d", "1w2d3h10s" or "2d4h10s".
-
-
Constructor Summary
Constructors Constructor Description Time()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
cronInterval(java.lang.String cron)
Compute the number of milliseconds between the next valid date and the one afterstatic long
cronInterval(java.lang.String cron, java.util.Date date)
Compute the number of milliseconds between the next valid date and the one afterstatic java.util.Date
parseCRONExpression(java.lang.String cron)
Parse a CRON expressionstatic int
parseDuration(java.lang.String duration)
Parse a duration
-
-
-
Method Detail
-
parseDuration
public static int parseDuration(java.lang.String duration)
Parse a duration- Parameters:
duration
- 3h, 2mn, 7s or combination 2d4h10s, 1w2d3h10s- Returns:
- The number of seconds
-
parseCRONExpression
public static java.util.Date parseCRONExpression(java.lang.String cron)
Parse a CRON expression- Parameters:
cron
- The CRON String- Returns:
- The next Date that satisfy the expression
-
cronInterval
public static long cronInterval(java.lang.String cron)
Compute 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(java.lang.String cron, java.util.Date date)
Compute the number of milliseconds between the next valid date and the one after- Parameters:
cron
- The CRON Stringdate
- The date to start search- Returns:
- the number of milliseconds between the next valid date and the one after, with an invalid interval between
-
-