Cron Expression for Every 4 Hours
0 */4 * * *
Expression Breakdown
The cron expression 0 */4 * * * schedules a job to run every 4 hours. A standard cron expression consists of five fields representing minute, hour, day of month, month, and day of week. Here is what each field means in this expression:
| Minute | 0 — at the top of the hour |
| Hour | */4 — every 4th hour (0, 4, 8, 12, 16, 20) |
| Day of Month | * — every day of the month |
| Month | * — every month |
| Day of Week | * — every day of the week |
This schedule runs 6 times per day (0.25 times per hour), which amounts to 42 times per week and approximately 180 times per month.
Next 5 Run Times
Starting from April 11, 2026 00:00 UTC, the next five executions are:
2026-04-11T00:00:00Z— Sat, 11 Apr 2026 00:00:00 GMT2026-04-11T04:00:00Z— Sat, 11 Apr 2026 04:00:00 GMT2026-04-11T08:00:00Z— Sat, 11 Apr 2026 08:00:00 GMT2026-04-11T12:00:00Z— Sat, 11 Apr 2026 12:00:00 GMT2026-04-11T16:00:00Z— Sat, 11 Apr 2026 16:00:00 GMT
Common Use Cases
Running a task every 4 hours is a popular cron schedule. Here are some typical applications:
- CDN cache: CDN cache purge and content refresh
- Incremental database: Incremental database backup snapshots
- API rate: API rate limit reset monitoring
- Scheduled search: Scheduled search index rebuilds for large datasets
Code Examples
Linux / macOS Crontab
# Open crontab editor
crontab -e
# Add this line to run your script every 4 hours
0 */4 * * * /usr/local/bin/my-task.sh
# With logging
0 */4 * * * /usr/local/bin/my-task.sh >> /var/log/my-task.log 2>&1
Python (schedule library alternative)
# Using APScheduler with cron trigger
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
scheduler = BlockingScheduler()
trigger = CronTrigger.from_crontab("0 */4 * * *")
scheduler.add_job(my_function, trigger)
scheduler.start()
JavaScript (Node.js with node-cron)
const cron = require('node-cron');
// Run task every 4 hours
cron.schedule('0 */4 * * *', () => {
console.log('Task running at', new Date().toISOString());
// Your task logic here
});
Frequently Asked Questions
What does each field in 0 */4 * * * mean?
A cron expression has five fields separated by spaces: minute (0-59), hour (0-23), day of month (1-31), month (1-12), and day of week (0-7, where 0 and 7 are Sunday). The */n syntax means "every nth interval." In 0 */4 * * *, the fields are: 0 — at the top of the hour; */4 — every 4th hour (0, 4, 8, 12, 16, 20); * — every day of the month.
How do I verify that 0 */4 * * * is correct?
Use the EpochPilot Cron Expression Builder to paste your expression and see the next run times visually. You can also use the crontab -l command to list your current crontab entries, or test with a simple echo command: 0 */4 * * * echo "test" >> /tmp/cron-test.log.
What timezone does cron use?
By default, cron uses the system timezone configured on your server. On most cloud servers this is UTC. You can check your system timezone with timedatectl on Linux or date +%Z. Some cron implementations (like Kubernetes CronJobs) let you specify a timezone explicitly. Always verify your server's timezone to ensure jobs run at the expected times.
Try the Cron Expression Builder to create and test cron schedules.