Cron expression for twice a day
0 9,21 * * *At 09:00 and 21:00, every day.
A list in the hour field runs the job at each listed hour: here 09:00 and 21:00. Use 0 */12 * * * for midnight and noon.
Try it and tweak it
Change any field below and the preview updates. Set the time zone to match your server.
✓ Valid cron
At 09:00 and 21:00, every day.
Next 10 runs
Calculating in your browser…
Times are computed in your browser for the selected zone and are informational. The server that runs the job uses its own zone (often UTC) and cron flavour, so verify there.
Same schedule in other dialects
Unix crontab
0 9,21 * * *Quartz
0 0 9,21 * * ?Spring @Scheduled
0 0 9,21 * * ?AWS EventBridge
cron(0 9,21 * * ? *)Add it to your crontab
- Open your crontab with
crontab -e. - Add one line:
0 9,21 * * * /full/path/to/command >> /var/log/job.log 2>&1 - Save and exit. Cron reloads automatically; confirm with
crontab -l.
Need the output silenced, a lock against overlapping runs or a system crontab user column? The generator’s full crontab line builder writes it for you. Already have a crontab? Paste it into the crontab parser to check every job.
Variations
0 */12 * * * | Midnight and noon |
30 8,17 * * 1-5 | 08:30 and 17:30 on weekdays |
In other schedulers
| crontab line | 0 9,21 * * * /path/to/command |
| Quartz | 0 0 9,21 * * ? |
| Spring | @Scheduled(cron = "0 0 9,21 * * ?") |
| AWS EventBridge | cron(0 9,21 * * ? *) |
| GitHub Actions | - cron: '0 9,21 * * *' (UTC) |
| Kubernetes | schedule: "0 9,21 * * *" |
Questions
What is the cron expression for twice a day?
0 9,21 * * *. At 09:00 and 21:00, every day.
How do I write it in Quartz or Spring?
Add a seconds field and use "?" for the unused day field: 0 0 9,21 * * ?. In Spring: @Scheduled(cron = "0 0 9,21 * * ?").
What is the AWS EventBridge version?
cron(0 9,21 * * ? *). AWS uses six fields with a year at the end and needs "?" in one of the day fields.
How do I set up a cron job to run twice a day?
Run crontab -e, add the line "0 9,21 * * * /full/path/to/command >> /var/log/job.log 2>&1" and save. Use absolute paths, because cron runs with a minimal PATH. Check it with crontab -l.
Which time zone will it use?
The time zone of the machine or service running cron. GitHub Actions and Vercel use UTC; Kubernetes uses spec.timeZone if set. The preview above lets you pick a zone.