Skip to content
Developer tools

Cron Expression Explainer

Type a cron schedule in standard, Quartz or AWS syntax and read what it means in plain English, with each field expanded, the next runs in any time zone and ready snippets.

Last checked

Expression

Build an expression field by field

Meaning

Every 15 minutes from 09:00 to 17:59, Monday to Friday.

Fields
Minute*/150, 15, 30, 45
Hour9-179, 10, 11, 12, 13, 14, 15, 16, 17
Day of month*any
Month*any
Day of week1-51, 2, 3, 4, 5

Next runs

Working out the dates...

Ready snippets

GitHub Actions

on:
  schedule:
    - cron: "*/15 9-17 * * 1-5"

GitHub runs schedules in UTC unless you add timezone, only on the default branch, and no more often than every 5 minutes; runs can be delayed under load.

Kubernetes CronJob

apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-job
spec:
  schedule: "*/15 9-17 * * 1-5"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: my-job
              image: busybox:1.36
              command: ["sh", "-c", "date"]
          restartPolicy: OnFailure

timeZone is stable since Kubernetes 1.27; without it the controller uses its own local zone. CRON_TZ or TZ inside the schedule is rejected.

systemd timer

OnCalendar=Mon,Tue,Wed,Thu,Fri *-*-* 09,10,11,12,13,14,15,16,17:00/15:00

Put the line in the [Timer] section of a .timer unit and check it with systemd-analyze calendar.

How to use it

  1. Pick the syntax: standard cron, Quartz or AWS EventBridge. Then type or paste the expression, pick a preset, or open the generator and choose a rule per field.
  2. Read the meaning and the expanded values of each field. Errors name the field and the rule that failed.
  3. Choose the time zone the job runs in to see the next run times, then copy a snippet, the meaning or a share link.

What it checks and why

A cron expression has five fields separated by spaces: minute (0 to 59), hour (0 to 23), day of month (1 to 31), month (1 to 12) and day of week (0 to 7, where both 0 and 7 are Sunday). A field can be *, a number, a list with commas, a range with a dash, or a step such as */15. Months and weekdays also take three-letter names like jan or mon.

One rule surprises people. When both the day of month and the day of week are restricted, cron runs the job when either matches, not both. The crontab manual's own example, 30 4 1,15 * 5, runs at 04:30 on the 1st and 15th of every month and also on every Friday. The explainer and the next-run list follow that rule.

The parser follows the crontab(5) manual used by Vixie cron and cronie on Linux, which also defines the @hourly, @daily, @weekly, @monthly, @yearly and @reboot nicknames. The POSIX crontab specification has the same five fields.

Quartz puts a seconds field first and allows an optional year (1970 to 2099) last. Its day of week runs 1 to 7 or SUN to SAT, so 1 is Sunday, not Monday. Its documentation says support for setting both day fields is not complete, so one of them must be ?. L means the last day (L-3 is the third to last, LW the last weekday), 15W the weekday nearest the 15th within the same month, 6L the last Friday and 6#3 the third Friday.

AWS EventBridge uses six fields: minutes, hours, day of month, month, day of week and a year from 1970 to 2199, usually wrapped as cron(...). It has the same ?, L, W and # as Quartz, does not accept values in both day fields (* in one needs ? in the other), allows one expression only when # is used, and cannot run more often than once a minute. Scheduled rules run in UTC; EventBridge Scheduler can evaluate a schedule in a time zone you choose.

Where a job runs changes the time zone. GitHub Actions runs schedules in UTC unless the workflow sets timezone, only on the default branch and at most every 5 minutes. A Kubernetes CronJob uses the controller's local zone unless spec.timeZone is set (stable since 1.27). A systemd timer can name a zone at the end of OnCalendar=.

Specs and sources

Limits

  • Spring's six-field cron and other dialects are not separate modes; check their own documentation before reusing a Quartz expression there.
  • Next runs skip wall times that a daylight saving jump removes and run repeated times once, at the first occurrence. That matches EventBridge Scheduler's documented behaviour; cron daemons differ, and Vixie cron, for example, has its own rules for jobs near the change.
  • Next runs search up to five years ahead, or across the years the expression allows.
  • Like Vixie cron, a standard day field that starts with * (such as */2) counts as unrestricted for the either-day rule, so */2 with 1-5 means days that match both.
  • The generator writes standard five-field cron only. For Quartz and AWS, start from a preset and edit the text.
  • Snippets need a five-field form, so Quartz seconds, year limits and L, W or # are not carried to GitHub or Kubernetes. systemd has no nearest-weekday rule, so W is reported as not expressible.

Questions

What does */5 * * * * mean?
Every 5 minutes: at minute 0, 5, 10 and so on up to 55, every hour of every day.
How do I run a cron job every weekday at 9 am?
Use 0 9 * * 1-5: minute 0, hour 9, any day of month, any month, Monday (1) to Friday (5).
Is Sunday 0 or 7 in cron?
Both. The crontab manual accepts 0 or 7 for Sunday, or the three-letter name sun, in the day of week field.
Why does my cron run on more days than I expected?
If you set both the day of month and the day of week, cron runs when either one matches. Leave one of them as * to make the other the only condition.
What time zone does cron use?
Usually the time zone of the machine that runs the cron daemon. GitHub Actions uses UTC by default and AWS EventBridge rules use UTC. Pick the zone the job runs in from the list to see the right next runs.
Does it support a seconds field?
Yes, in Quartz mode, where seconds come first. Standard cron has five fields and the smallest step is one minute; AWS EventBridge also has no seconds field.
How do I run a cron job every 2 days?
Use 0 0 */2 * * for midnight on every 2nd day of the month: the 1st, 3rd, 5th and so on. The count restarts each month, so after the 31st the next run is the 1st, one day later. For an exact 48-hour interval, use a timer that tracks the last run instead of cron.
What does ? mean in a cron expression?
No specific value. Quartz and AWS use it in either day of month or day of week, whichever you do not want to set, because they do not accept values in both.
Why does my AWS cron expression have six fields?
AWS EventBridge adds a year field at the end and has no seconds field, so cron(0 10 * * ? *) means 10:00 UTC every day.
Can GitHub Actions run a schedule every minute?
No. GitHub's documentation says the shortest interval is once every 5 minutes, and scheduled runs can be delayed when GitHub is busy.