Cron Expression for Every 6 Hours
The cron expression for "every 6 hours", what each field means, and the next run times on your clock.
What is the cron expression for every 6 hours? The cron expression for every 6 hours is 0 */6 * * *. Minute 0 and an hour step of 6 match 00:00, 06:00, 12:00 and 18:00, so the job runs four times a day in the scheduler's time zone. To start at another hour, list the hours instead, for example 0 3,9,15,21 * * *.
0 */6 * * *On the hour, every 6 hours
- …
- …
- …
- …
- …
How do you run every 6 hours from a different start time?
Write the four hours as a list or as a range with a step. 0 3,9,15,21 * * * and 0 3-23/6 * * * are the same schedule: 03:00, 09:00, 15:00 and 21:00. The list is easier to read in a code review, and the range is quicker to change when the start hour moves.
Keep the start between hour 0 and hour 5. A range that starts at 6 or later loses a run, because cron stops at the end of the range instead of carrying the step past midnight: 0 6-23/6 * * * gives 06:00, 12:00 and 18:00, three runs a day. Runs at 06:00, 12:00, 18:00 and midnight are just 0 */6 * * * again, since the schedule is the same whichever run you count as first.
What happens to a 6-hour schedule when the clocks change?
Cron matches clock times, not elapsed time. On a server that follows daylight saving in a zone that switches in the early morning, the night the clocks go forward turns the 00:00 to 06:00 gap into 5 real hours, and the night they go back stretches it to 7. If the job needs a true 6 hours between runs, schedule it in UTC, which has no daylight saving.
Most schedulers let you set the zone with the schedule. Kubernetes CronJobs take a .spec.timeZone field such as Etc/UTC, and reject CRON_TZ or TZ written into the schedule itself. GitHub Actions schedules run in UTC unless the workflow names a time zone.
Frequently asked
What times does 0 */6 * * * run?
00:00, 06:00, 12:00 and 18:00 every day, in the time zone the scheduler uses. On a UTC server in winter, that is 19:00, 01:00, 07:00 and 13:00 in New York.
How do I run every 6 hours starting at midnight?
0 */6 * * * already does. The step counts from hour 0, so the first run of each day is at 00:00. The same schedule written as a list is 0 0,6,12,18 * * *.
Why does 0 6-23/6 * * * only run three times a day?
The range ends at 23, so stepping by 6 from hour 6 gives 6, 12 and 18 and stops. Cron does not carry a step past midnight. Start the range at an hour from 0 to 5, or use */6, to get four runs.