Cron Every Night at 2 AM
Schedule a cron job to run every night at 2 AM using 0 2 * * *. Includes full field-by-field explanation and best practices for nightly jobs.
Cron Expression
0 2 * * *
Field Breakdown
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | At 0 |
| Hour | 2 | At 2 |
| Day of Month | * | Every day of the month (1–31) |
| Month | * | Every month (1–12) |
| Day of Week | * | Every day of the week (Sun–Sat) |
Detailed Explanation
The cron expression 0 2 * * * schedules a task to run once per day at exactly 2:00 AM.
Field-by-field breakdown:
0(Minute): At minute 0. The task fires at the top of the hour, not at any other minute.2(Hour): At hour 2 (2 AM). The task is restricted to the 2 AM hour only, which falls in the early morning low-traffic window.*(Day of Month): Every day from 1 through 31. No restriction on the day of the month.*(Month): Every month from January through December. No restriction on which month.*(Day of Week): Every day of the week from Sunday through Saturday. No restriction on the day of the week.
This means your task will execute once per day, every day, at 2:00 AM server time. The 2 AM slot is one of the most popular choices for nightly batch jobs because it avoids the midnight rush of day-boundary tasks and falls well within off-peak hours for most businesses. Be mindful of daylight saving time transitions: in many time zones, 2 AM is when clocks spring forward or fall back, which can cause your job to be skipped or run twice. Consider using UTC-based scheduling to avoid this issue. 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
Ideal for nightly database backups that need to run during the lowest-traffic window to minimize impact on production database performance.
Try It — Interactive Builder
Every day at 2:00 AM
Next 10 Executions
Ctrl+Shift+C to copy expression