Cron Expression
From LongJump Support Wiki
Revision as of 02:02, 24 January 2011 by imported>Aeric
A cron expression is a compact syntax used to specify a repeating sequence of times.
- To define a cron expression
-
- Specify a repetition interval in Quarz scheduler cron format:
Secs Mins Hrs DayOfMon Mon DayOfWk Yr
where:
- Values are separated by one or more spaces
- Seconds, minutes, and hours are zero-based
- Day and month values are 1-based
- Month can be specified as either 1-12 or JAN-DEC
- Day of week can be specified as either 1-7 or SUN-SAT
- Values can be specified as:
- ? - Don't care
- * - All
- A range - Two values separated by a hyphen: 0-3 (first through fourth)
- An interval - A starting value an interval separated by a slash: 0/5 (zeroth and every fifth)
- A list - Multiple values separated by values: 0,1,3-6,10/10
- Nearest weekday - Value followed by a "W": 15W
- Last - An "L" by itself (last day of month), or value followed by an "L": 5L (last Friday)
- Specify a repetition interval in Quarz scheduler cron format:
- Example
- ? ? 13 0,14 * ? *
- Seconds = ? (don't care)
- Minutes = ? (don't care)
- Hours = 13 (1 pm)
- Day of Month = 0,14 (First and fifteenth--zero-based)
- Month = * (all)
- Day of Week = ? (don't care)
- Year (optional) = * (all)
- Learn more: Quartz scheduler cron format