epochkit

Cron expression for every 3 hours

The cron expression 0 */3 * * * runs on the hour, every 3 hours. The restricted fields are minute 0 and hour */3; the remaining asterisks match anything. That works out to 8 runs per day.

0 */3 * * *

Field breakdown

Field-by-field meaning of the cron expression 0 */3 * * *
Field Value Meaning
Minute 0 The top of the hour (:00)
Hour */3 Every 3 hours, counted from 0: 0, 3, 6, 9, 12, 15, …
Day of month * Every day of the month (1–31)
Month * Every month (1–12)
Day of week * Every day of the week (0–6)

Next runs

Next 5 runs Timezone: UTC

Run times are calculated in your browser timezone. The scheduler that executes the job uses its own — always UTC on Vercel Cron, UTC by default on GitHub Actions, the host clock on crontab.

How this schedule works

Cron evaluates the five fields of 0 */3 * * * — minute, hour, day of month, month, day of week — against the clock once a minute and starts the job on any minute where all five match, which cronstrue reads as "On the hour, every 3 hours": 8 runs per day. The runs land at 00:00, 03:00, 06:00, 09:00, 12:00, 15:00, 18:00, 21:00. Twenty-four divides by 3 without a remainder, so the spacing survives midnight: the gap from the 21:00 run to the next day's 00:00 run is the same 3 hours as every other gap.

When to use every 3 hours

Eight runs a day fit incremental backups, third-party token refreshes with a multi-hour lifetime, and syncs where a three-hour gap is acceptable but a full day is not. The interval divides the day evenly, so the spacing holds across midnight and every run gets the same headroom as the last. It is a common landing spot for jobs that are expensive enough that hourly would be wasteful, yet important enough that a daily run would leave too much backlog to work through in a single invocation.

Common mistakes with every 3 hours

Three divides 24, so this schedule is well behaved — which is exactly why people generalise from it and get burned. Copy the pattern to */5 in the hour field, assume the same clean rollover, and you end up with a four-hour gap between the 20:00 run and midnight. Check the divisor before trusting a step in the hour field. The other thing to watch is the assumption inside the job: code that computes "the last three hours" from the current clock will double-count when a run is late and lose data when one is skipped. Read from a stored watermark instead.

Platform snippets

The same expression, ready to paste into the four schedulers that read five-field cron. The notes below each snippet are the ones that follow from this schedule; the cron expression generator lists every caveat for every platform.

GitHub Actions

yaml
name: Scheduled workflow
on:
  schedule:
    - cron: '0 */3 * * *'
  workflow_dispatch:

jobs:
  scheduled:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run job
        run: echo "Running scheduled job"
  • • Workflows scheduled at the top of the hour may be delayed during high-load periods. Consider offsetting the minute field (e.g. "5 */3 * * *") for more reliable timing.

Kubernetes CronJob

yaml
apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-cron-job
spec:
  schedule: "0 */3 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: job
              image: my-image:latest
              command: ["/bin/sh", "-c", "echo Running"]
          restartPolicy: OnFailure

Vercel Cron

json

Hobby plan limitation: cron jobs can only run once per day. Schedules more frequent than daily will fail to deploy on Hobby. Use Pro plan or above for higher frequency.

{
  "$schema": "https://openapi.vercel.sh/vercel.json",
  "crons": [
    {
      "path": "/api/cron",
      "schedule": "0 */3 * * *"
    }
  ]
}
  • • Pro plan and above: invocations occur within the specified minute (e.g. "5 8 * * *" runs between 08:05:00 and 08:05:59).

crontab

bash
# Edit your crontab: crontab -e
0 */3 * * * /path/to/command

# With logging:
0 */3 * * * /path/to/command >> /var/log/cron.log 2>&1

Variations

Frequently asked questions

How do I read the cron expression 0 */3 * * *?

Read the five space-separated fields left to right as minute, hour, day of month, month, and day of week. In 0 */3 * * * the minute is 0, hour is */3, day of month is *, month is *, day of week is *. Of the operators cron defines, this expression uses only the ones that matter here: an asterisk matches every value in its field and a slash introduces a step counted from the start of the field. Put together, cronstrue reads the whole thing as "On the hour, every 3 hours", and a scheduler that checks all five fields once a minute will start the job 8 runs per day.

What timezone does 0 */3 * * * run in?

The schedule repeats through the day at fixed hours — 00:00, 03:00, 06:00, 09:00, 12:00, 15:00, 18:00, 21:00 — and which part of the day those hours fall in depends entirely on the scheduler. Moving between zones does not change how often the job runs; it changes when. GitHub Actions defaults to UTC and takes an optional timezone key next to cron, so the hours can be anchored to an IANA zone. Vercel Cron always evaluates in UTC, with no setting to change it. Kubernetes CronJobs use the controller's local zone unless spec.timeZone is set, and a CRON_TZ prefix inside the schedule string is rejected outright. A crontab follows the host clock unless CRON_TZ overrides it. In any zone that observes daylight saving, the whole set of run hours shifts by one twice a year.

Does 0 */3 * * * keep a 3-hour gap across midnight?

The hour field spans 0 to 23 and 3 divides 24 evenly, so the sequence 00:00, 03:00, 06:00, 09:00, 12:00, 15:00, 18:00, 21:00 rolls over cleanly: the gap from the 21:00 run to the next day's 00:00 run is exactly three hours. Uneven steps do not behave this way. A step such as */5 in the hour field fires at 00:00, 05:00, 10:00, 15:00, and 20:00, then restarts at midnight after only a four-hour gap. Steps that divide 24 (2, 3, 4, 6, 8, 12) are the only ones that stay uniform across the day boundary.

Related cron schedules

Build a custom schedule in the cron expression generator, or browse every epochkit tool.