CronExpression

A cron expression of six fields, with the syntax of Spring's CronExpression, evaluated without a dependency: second minute hour day-of-month month day-of-week.

  • Each field is * (or ?), a value, a range a-b, a step x/n (from x, a value, a range or *, every n), or a list of them separated by commas. Months may be named JAN–DEC, days of the week SUN–SAT, in any case; a day of the week is 0–7, both 0 and 7 Sunday.

  • Day of month: L is the last day of the month, L-n the n-th day before it, LW its last weekday, nW the weekday nearest to day n within the month.

  • Day of week: dL is the last day d of the month (5L, FRIL), d#n its n-th day d (MON#1).

  • A day must match both day fields, as Spring reads them.

  • The macros @yearly (@annually), @monthly, @weekly, @daily (@midnight) and @hourly.

next reads the fields as local times of a time zone: a local time that a daylight saving gap skips runs at the instant it would have been, later by the length of the gap (02:30 in a spring-forward gap runs at 03:30), unless an earlier time already ran at that instant; a local time that an overlap repeats runs once, at its earlier offset. The times run in the order of their instants: one a gap shifted past the local times right after the gap runs after them (02:20 in a half-hour gap from 02:00 runs at 02:50, after 02:40).

Types

Link copied to clipboard

Properties

Link copied to clipboard

The expression as given.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun next(after: Instant, zone: ZoneId): Instant?

The first time after after that this expression names in zone, or null when it names none within MAX_YEARS years (such as 0 0 0 30 2 *). Those 400 years are a whole cycle of the Gregorian calendar, whose dates fall on the same weekdays every 400 years: an expression with no time in them has none ever.

Link copied to clipboard
open override fun toString(): String