Cron expressions consist of the following seven fields:
- Seconds
- Minutes
- Hours
- Day-of-month
- Month
- Day-of-week
- Year (optional field)
Special characters
Cron triggers utilize a series of special characters, as follows:
- The backslash (/) character denotes value increments. For
example, "5/15" in the seconds field means every 15 seconds starting at
the fifth second.
- The question (?) character and the letter-L (L) character are
permitted only in the day-of-month and day-of-week fields. The question
character indicates that the field should hold no specific value.
Therefore, if you specify the
day-of-month, you can insert a "?" in the day-of-week field to indicate
that
the day-of-week value is inconsequential. The letter-L character is
short for
last. Placed in the day-of-month field, this schedules
execution for the last day of the month. In the day-of-week field, an
"L" is equivalent to a "7" if placed by itself or means the last
instance of the day-of-week in the month. So "0L" would schedule
execution for the last Sunday of the month.
- The letter-W (W) character in the day-of-month field schedules
execution on the weekday nearest to the value specified. Placing "1W"
in the day-of month
field schedules execution for the weekday nearest the first of the
month.
- The pound (#) character specifies a particular instance of a
weekday for a
given month. Placing "MON#2" in the day-of-week field schedules a task
on the second Monday of the month.
- The asterisk (*) character is a wildcard character and indicates
that every
possible value can be taken for that specific field.