- Home
- Tools
- Developer Tools
- Cron Expression Explainer
- Cron Expression for Every Sunday
Cron Expression for Every Sunday
0 0 * * 0 runs a job every Sunday at 00:00, the same as @weekly. In a crontab, Sunday can be written as 0 and as 7.
At 00:00 on Sunday
| Field | Value | Matches |
|---|---|---|
| Minute | 0 | 0 |
| Hour | 0 | 0 |
| Day of month | * | every day of the month |
| Month | * | every month |
| Day of week | 0 | Sunday |
Next 10 runs
Cron goes by the clock of the machine it runs on. These are the runs on a machine in your time zone.
The weekly job
0 0 * * 0 runs at 00:00 on Sunday, which is the night from Saturday to Sunday. The shortcut @weekly stands for exactly this expression.
| Expression | Runs |
|---|---|
| 0 0 * * 0 | At 00:00 on Sunday |
| @weekly | At 00:00 on Sunday |
| 0 0 * * 7 | At 00:00 on Sunday |
| 0 0 * * SUN | At 00:00 on Sunday |
| 0 4 * * 0 | At 04:00 on Sunday |
| 0 0 * * 6,0 | At 00:00 on Saturday and Sunday |
Zero or seven
A crontab accepts both 0 and 7 for Sunday, and SUN as well. The first three rows of the table all give the schedule of this page. A range that ends on Sunday is best written with 7 or with names: 5-7 and FRI-SUN are Friday to Sunday.
Quartz numbers the days differently. There 1 is Sunday and 7 is Saturday, so a number copied from one system to the other is a day off. Names work in both.
The night the clocks change
In Europe and North America the clocks go forward and back early on a Sunday morning, at some point between 01:00 and 04:00 depending on the country. A weekly job in those hours meets that twice a year: once the time doesn't exist, and once it comes round twice. Midnight is safe there, and so is anything from 04:00 on, such as 0 4 * * 0.
The cron expression explainer has the full syntax: the five fields, lists, ranges and steps, and how day of month and day of week work together.