Skip to content

Cron

Parses cron expressions into an iterator of matching dates.

Used by CronScheduledTriggerExecutor.getSchedule to compute when a CronScheduledTrigger fires. Supports the standard 5 fields (minute, hour, day of month, month, day of week) with *, lists, ranges and */n steps. Adapted from code by rbubke; see the license in this file.

Constructors

Cron

Cron()

Creates a cron parser and initializes the time zone database.

Methods

parse

CronIterator<TZDateTime> parse(
  1. String cronString,
  2. String locationName, [
  3. TZDateTime? startTime
])

Returns a CronIterator over the times matching cronString.

Times are in the time zone locationName, starting from startTime. If no startTime is provided, now in locationName is used. locationName is an IANA time zone name, e.g. Europe/Copenhagen (see http://www.iana.org/time-zones).