Difference between revisions of "Cron Expression"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
Line 19: | Line 19: | ||
|} | |} | ||
The asterisk (*) character specifies all values. For example, * in the minute field implies every minute. | The asterisk (*) character specifies all values. For example, * in the minute field implies every minute. | ||
The question mark (?) character specifies the '''day-of-month''' field and '''day-of-week''' field. You can select only one field at a time. | |||
The question mark (?) character specifies the '''day-of-month''' field and '''day-of-week''' field. You can select only one field at a time. | |||
The hyphen (-) character specifies the range. For example, 10-12 in the hour field implies the hours 10, 11 and 12. | The hyphen (-) character specifies the range. For example, 10-12 in the hour field implies the hours 10, 11 and 12. | ||
Revision as of 08:19, 13 March 2017
A Cron expression is a syntax used to specify a repeating sequence of time. A Cron expression comprises of six mandatory fields and one optional field. All expressions are separated by a space. The fields are described in the following table:
Field name
Allowed values
Allowed special charactersSeconds 0-59 , - * / Minutes 0-59 , - * / Hours 0-23 , - * / Day-of-month 1-31 , - * ? / L W Month 1-12 or JAN-DEC , - * / Day-of-Week 1-7 or SUN-SAT , - * ? / L # Year (optional) empty, 1970-2199 , - * /
The asterisk (*) character specifies all values. For example, * in the minute field implies every minute.
The question mark (?) character specifies the day-of-month field and day-of-week field. You can select only one field at a time.
The hyphen (-) character specifies the range. For example, 10-12 in the hour field implies the hours 10, 11 and 12.
- Example - 10 * 13 1,14 * ? *
- Seconds = 10 (10 second)
- Minutes = * (all)
- Hours = 13 (1 pm)
- Day of Month = 1,14 (First and fourteenth one-based)
- Month = * (all)
- Day of Week = ? (don't care)
- Year (optional) = * (all)
- Learn more: Quartz scheduler cron format