GetNextCronTime (open)
Calculate the next timestamp based on a cron-style mask
Syntax
LOADLIB "wh::datetime.whlib";
DATETIME FUNCTION GetNextCronTime(DATETIME now, STRING cronmask)
Parameters
DATETIME now
Current time
STRING cronmask
Cron-style mask: <minute> <hour> <dayofmonth> <month> <dayofweek>
Return value
DATETIME
Next timestamp
Description
Cron masks specify a way to calculate the 'next' time for an event. The 5 slots can be filled with a comma
separated list of numbers (will trigger at those times), a wildcard *
to specify 'every occurence' and a wildcard
combined with a slash to specify an interval, eg */5
for every 5 minutes.
Some examples:
Mask | Effect |
---|---|
25 8 * * * |
runs daily at 8:25 |
*/4 * * * * |
runs every 4 minutes |
12 18 5 * * |
runs the 5th of every month, at 18:12 |
0 14 * * 1 |
runs every monday at 14:00 |
17 8,20 * * * |
runs at 08:17 and 20:17 |
If both day-of-week and day-of-month fields are restricted (ie not *
), the mask
will match the first date/time that matches either of these fields