Back to Blog
Guide8 min read2026-05-01

Cron Expression Syntax: Complete Reference with Examples

A complete reference for cron expression syntax covering every field, special characters, and real-world scheduling patterns with examples.

Cron Expression Syntax: Complete Reference

Cron expressions are deceptively simple: five fields separated by spaces, each controlling a different unit of time. But between wildcards, ranges, steps, and lists, there's a lot of power packed into that compact format. This guide covers everything you need to write any cron expression confidently.

The Five Fields

┌───────── minute        (0–59)
│ ┌─────── hour          (0–23)
│ │ ┌───── day of month  (1–31)
│ │ │ ┌─── month         (1–12 or JAN–DEC)
│ │ │ │ ┌─ day of week   (0–7, 0 and 7 = Sunday, or SUN–SAT)
│ │ │ │ │
* * * * *

Some systems add a sixth field for seconds (at position 0) or year (at position 5). The standard Unix cron and most cloud schedulers — including PandaStack — use the five-field format.

Special Characters

Asterisk * — matches every value in a field.

# Run every minute of every hour every day
* * * * *

Comma , — specifies a list of values.

# Run at 8 AM and 6 PM every day
0 8,18 * * *

# Run on Monday, Wednesday, and Friday
0 9 * * 1,3,5

Hyphen - — defines a range of values.

# Run every hour from 9 AM to 5 PM
0 9-17 * * *

# Run Monday through Friday at midnight
0 0 * * 1-5

Slash / — defines a step value (every N units).

# Run every 15 minutes
*/15 * * * *

# Run every 2 hours
0 */2 * * *

# Run every 5 minutes between minutes 0 and 30
0-30/5 * * * *

Question mark ? — used in some systems to mean "no specific value" for day-of-month or day-of-week (Quartz scheduler). Standard cron uses * instead.

Common Scheduling Patterns

Minutely and Hourly

# Every minute
* * * * *

# Every 5 minutes
*/5 * * * *

# Every 10 minutes
*/10 * * * *

# Every 30 minutes
*/30 * * * *

# Every hour (at minute 0)
0 * * * *

# Every hour at minute 30
30 * * * *

Daily Schedules

# Every day at midnight
0 0 * * *

# Every day at noon
0 12 * * *

# Every day at 3:30 AM
30 3 * * *

# Twice a day at 8 AM and 8 PM
0 8,20 * * *

Weekly Schedules

# Every Sunday at midnight
0 0 * * 0

# Every Monday at 9 AM
0 9 * * 1

# Every weekday (Mon–Fri) at 7 AM
0 7 * * 1-5

# Every weekend at noon
0 12 * * 6,0

Monthly and Yearly Schedules

# First day of every month at midnight
0 0 1 * *

# Last day-ish: 28th of every month (safe across all months)
0 0 28 * *

# Every quarter (1st of Jan, Apr, Jul, Oct)
0 0 1 1,4,7,10 *

# Once a year on January 1st at midnight
0 0 1 1 *

Practical Business Examples

# Send weekly digest email every Monday at 7 AM
0 7 * * 1

# Nightly database backup at 2 AM
0 2 * * *

# Clear expired sessions every 6 hours
0 */6 * * *

# Generate monthly invoice on the 1st at 1 AM
0 1 1 * *

# Run health checks every 5 minutes
*/5 * * * *

# Sync external API data every 30 minutes during business hours on weekdays
*/30 9-17 * * 1-5

Scheduling Docker Containers on PandaStack

PandaStack uses standard five-field cron expressions when creating scheduled container jobs. Use the CLI to set any of the expressions above:

npm install -g @pandastack/cli

# Nightly backup at 2 AM
panda cronjob create \
  --name nightly-backup \
  --image your-registry/backup:latest \
  --schedule "0 2 * * *"

# Every 15 minutes health check
panda cronjob create \
  --name health-check \
  --image your-registry/healthcheck:latest \
  --schedule "*/15 * * * *"

# List all cronjobs
panda cronjob list

Validating Your Cron Expressions

Before deploying a scheduled job, validate the expression by checking:

  1. 1Field count: Make sure you have exactly five fields.
  2. 2Value ranges: Minute 0–59, Hour 0–23, Day 1–31, Month 1–12, Weekday 0–7.
  3. 3Conflict between day-of-month and day-of-week: When both are specified (not *), most implementations treat them as OR conditions — the job runs if either matches.
  4. 4Timezone: Know what timezone your scheduler uses. PandaStack schedules in UTC by default — factor in your local offset when setting business-hour jobs.

Summary

Cron expressions are a compact and powerful way to define recurring schedules. Master the five fields and four special characters (*, ,, -, /), and you can express virtually any scheduling pattern your application needs. Visit [docs.pandastack.io](https://docs.pandastack.io) for full documentation on scheduling Docker containers with PandaStack.

Ready to deploy?

Start free on PandaStack — no credit card required.

Start free on PandaStack

More in Guide

Browse all Guide articles →

See also