Crates.io | curds_cron |
lib.rs | curds_cron |
version | 0.2.0 |
source | src |
created_at | 2021-04-15 04:35:22.331228 |
updated_at | 2021-04-19 02:43:39.22002 |
description | A library for parsing and consuming CronExpressions. |
homepage | |
repository | https://github.com/whaycox/creamery-rs |
max_upload_size | |
id | 384666 |
size | 70,250 |
A library for creating and consuming Cron expressions. It supports some extended syntax.
A Cron expression is made up of five fields representing different parts of the current time. Each field defines some number of values that represent when the expression is matched. A Cron expression is matched when all of its fields are matched; a field is matched when any of its values are matched.
A simple Cron expression that matches all times looks like * * * * *
. It specifies a single value for each field, each of which is a wildcard.
The fields appear in the following order:
1 Minute
1 Hour
1 Day of Month
1 Month
1 Day of Week
Expression | Description |
---|---|
* * * * * |
Matches all times |
* 8-17 * * mon-fri |
Matches 8AM-5PM Mon-Fri |
* * L 3,6,9,12 * |
Matches the last day of each quarter |
30 1 * * * |
Matches 1:30AM every day |
There are four standard values that can be supplied for all fields:
*
)
5-10
)
10
)
*/2
)
The Day of Month field has two special values that can be supplied:
15W
)
L
or L-5
)
The Day of Week field has two special values that can be supplied:
3#2
)
2
nd occurrence of the day of week 3
(Wednesday)2L
)
Additionally, the Month and Day of Week fields can either have a numeric value or a three-letter alias supplied.
Alias | Value |
---|---|
JAN | 1 |
FEB | 2 |
MAR | 3 |
APR | 4 |
MAY | 5 |
JUN | 6 |
JUL | 7 |
AUG | 8 |
SEP | 9 |
OCT | 10 |
NOV | 11 |
DEC | 12 |
Alias | Value |
---|---|
SUN | 0 |
MON | 1 |
TUE | 2 |
WED | 3 |
THU | 4 |
FRI | 5 |
SAT | 6 |