SoftwareTestPilot
Automation TestingPublished: 8 min read

Cron Expression Cheat Sheet (2026) — Every Field, Every Shortcut, Every Gotcha

The complete cron expression cheat sheet for QA and DevOps: 5-field POSIX, 6/7-field Quartz, @hourly / @daily shortcuts, timezone traps, and 30 copy-paste examples for Jenkins, GitHub Actions, K8s, and pg_cron.

Avinash K
Founder & QA Engineer at SoftwareTestPilot
Share:XLinkedInWhatsApp
Cron expression cheat sheet with fields, shortcuts, and examples
Cron expression cheat sheet with fields, shortcuts, and examples

2026-07-17 · By Avinash K

Every SDET eventually stares at a cron expression like */15 9-17 * * 1-5 and wonders which field is which. This cheat sheet is the reference we keep pinned in Slack — five fields, six fields with seconds, seven with year, plus the shortcuts and gotchas that cost teams a real incident.

Field layout — POSIX (5 fields) vs Quartz (6-7)

POSIX (Linux crontab, GitHub Actions, K8s CronJob, pg_cron, Node-cron, Vercel)
minute       0-59
hour         0-23
day-of-month 1-31
month        1-12  (or JAN-DEC)
day-of-week  0-6   (0=Sun; some engines: 7=Sun)

Quartz (Jenkins Quartz plugin, Spring @Scheduled, Elastic Job)
sec  min  hour  dom  mon  dow  [year]
0    */15  9-17  ?    *    MON-FRI  2026

Gotcha: Quartz requires ? in either dom or dow (they can't both be specified). POSIX has no ?.

Operators - every symbol explained

*   every value        * * * * *      every minute
,   list               0,15,30,45 * * * *
-   range              0 9-17 * * *   every hour 9am-5pm
/   step               */5 * * * *    every 5 min
L   last (Quartz)      0 0 L * ?      midnight last day of month
W   nearest weekday    0 0 15W * ?    weekday closest to 15th
#   nth weekday        0 0 ? * 2#1    first Monday of month
?   no specific value  used in dom OR dow (Quartz only)

Shortcuts every QA should know

@yearly / @annually  ->  0 0 1 1 *
@monthly             ->  0 0 1 * *
@weekly              ->  0 0 * * 0
@daily / @midnight   ->  0 0 * * *
@hourly              ->  0 * * * *
@reboot              ->  run once at startup (crontab only, NOT K8s)

GitHub Actions and Kubernetes CronJob do not support @reboot. Jenkins pipeline supports @midnight with jitter (spreads jobs across the hour to avoid stampedes).

30 real-world expressions

# Smoke tests every 15 min during business hours, weekdays
*/15 9-17 * * 1-5

# Nightly regression at 2:30 AM
30 2 * * *

# Every Monday 6 AM - weekly report
0 6 * * 1

# First day of month, 00:05 - billing job
5 0 1 * *

# Every 6 hours
0 */6 * * *

# Twice a day (9 AM and 9 PM)
0 9,21 * * *

# Every Sunday at 3:15 AM - cleanup
15 3 * * 0

# Quartz: last Friday of month at 5 PM
0 0 17 ? * 6L

# Quartz: 2nd Tuesday at 10 AM
0 0 10 ? * 3#2

# Every 30 seconds (Quartz)
*/30 * * * * ?

Timezone traps that cost us a real incident

  • crontab uses the server timezone. Set CRON_TZ=UTC at the top of the file to make it explicit.
  • Kubernetes CronJob was UTC-only until v1.25; now use spec.timeZone: "America/New_York".
  • GitHub Actions schedules run in UTC only. There is no timezone option.
  • pg_cron uses the database's timezone setting - check with SHOW timezone;.
  • Daylight saving: a 0 2 * * * job will run twice on the fall-back day and skip on spring-forward. Use 0 3 * * * if you can't handle that.

Stop guessing - build and test in one place

Rather than counting stars in a terminal, paste any expression into the free Cron Expression Builder & Tester. It humanises the expression, shows the next 10 run times in your timezone, and exports the exact YAML/Groovy/SQL for Jenkins, GitHub Actions, Kubernetes CronJob, Quartz, Node-cron, pg_cron, Vercel, systemd, and AWS EventBridge.

Frequently asked questions

1.What's the difference between POSIX cron and Quartz cron?
POSIX uses 5 fields (minute through day-of-week). Quartz adds a seconds field at the front (6 fields) and an optional year at the end (7 fields). Quartz also supports L, W, and # operators that POSIX does not.
2.Why does */5 in the day-of-month field behave oddly?
Steps in day-of-month start from 1, not 0, and don't restart each month - */5 means the 1st, 6th, 11th, 16th, 21st, 26th, 31st every month, not 'every 5 days'.
3.Does GitHub Actions support timezones in cron?
No. All GitHub Actions cron schedules run in UTC. Convert your local time to UTC before writing the expression, or add a workflow step to guard on time-of-day.
4.How do I run a job every 30 seconds?
You need Quartz or Node-cron with the seconds field enabled (6-field format): */30 * * * * *. Standard POSIX cron cannot fire more than once per minute.