Cron Every Other Day
Schedule a cron job every other day at midnight using 0 0 */2 * *. Full field-by-field explanation, alternate-day scheduling tips, and use cases.
Cron Expression
0 0 */2 * *
Field Breakdown
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | At 0 |
| Hour | 0 | At 0 |
| Day of Month | */2 | Every 2nd day of month |
| Month | * | Every month (1–12) |
| Day of Week | * | Every day of the week (Sun–Sat) |
Detailed Explanation
The cron expression 0 0 */2 * * schedules a task to run every other day at midnight, on odd-numbered days of the month.
Field-by-field breakdown:
0(Minute): At minute 0. The task fires at the start of the hour.0(Hour): At hour 0 (midnight). The task runs at the beginning of each matching day.*/2(Day of Month): Every 2nd day, starting from day 1. The step value/2triggers execution on days 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, and 31.*(Month): Every month from January through December. No restriction on the month.*(Day of Week): Every day of the week. No restriction on the day of the week.
This means your task will execute approximately 15-16 times per month, every other day. Note that because months have varying lengths, the gap between the last day of one month and the first day of the next may not always be exactly two days. For example, after January 31st the next run is February 1st, creating back-to-back executions. Despite this edge case, this schedule is useful for tasks needing regular but not daily execution. This expression is supported by standard cron on Linux/macOS, as well as cloud services like AWS CloudWatch, Google Cloud Scheduler, and GitHub Actions.
Use Case
Useful for running database cleanup scripts that purge expired sessions and temporary records every other day to balance freshness and performance.
Try It — Interactive Builder
Every 2 days at midnight
Next 10 Executions
Ctrl+Shift+C to copy expression