Class CronSchedule
USING CRON <minute> <hour> <day-of-month> <month> <day-of-week> <time zone>
schedule, parsed once and asked for its next fire time on the calendar.
The grammar is the subset a real account accepts, field by field (live-verified): numbers,
*, lists, ranges, and steps — */n, a-b/n, and a/n, which
runs from a to the field's maximum; month names JAN–DEC and day names SUN–SAT in any
case; L in the day-of-month field (the month's last day, also as a list item); and
nL or FRIL in the day-of-week field (the month's last such weekday). Day of week
is 0–6. Refused, all with the one invalid-schedule sentence: ?, #, W, a
bare day-of-week L, L-3, a day-of-week 7, a step of 0, a reversed range, an empty
list item, an out-of-range value, and any field count but five.
★ DAY OF MONTH AND DAY OF WEEK ARE OR-ED WHEN BOTH ARE RESTRICTED: 0 0 1 * MON fires on
the 1st AND on every Monday, and a stepped */2 counts as restricted there. When
either field is a bare *, the other alone decides.
★ THE LAST TOKEN IS ALWAYS THE ZONE, which is why five fields and no zone are refused as an
unrecognized zone named "*". It must be a region name the TIMEZONE parameter accepts —
UTC, Etc/GMT+5, America/Los_Angeles, in any case — while an offset such
as +01:00 or an abbreviation such as PST is refused with a sentence naming it.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionnextFireAfter(ZonedDateTime from) The first whole minute strictly afterfromthat the schedule names, read in the schedule's own zone.static CronScheduleParse a wholeUSING CRON …schedule, refusing with the account's sentences.zone()The zone the fields are read in.
-
Field Details
-
INVALID_SCHEDULE_MESSAGE
The account's one sentence for every malformed schedule.- See Also:
-
NEVER_FIRES_MESSAGE
The sentence for a well-formed expression that names no instant at all, such as February 31st.- See Also:
-
-
Method Details
-
parse
Parse a wholeUSING CRON …schedule, refusing with the account's sentences.- Parameters:
schedule- the SCHEDULE text,USING CRONincluded- Returns:
- the parsed schedule
-
zone
The zone the fields are read in. -
nextFireAfter
The first whole minute strictly afterfromthat the schedule names, read in the schedule's own zone.- Parameters:
from- the instant to search after- Returns:
- the next fire, or null when none exists within the search window — which means none ever will
-