OhMyApps
Back to Blog
Tools Developer Cron Scheduling Tutorial

Cron Expression Parser: Understand and Build Cron Schedules

5 min read By OhMyApps

Cron expressions define schedules for recurring tasks — from running backups at midnight to sending reports every Monday morning. The syntax is powerful but cryptic. Our parser shows you exactly what a cron expression means and when it will run next.

Cron Expression Format

A standard cron expression has five fields:

┌───────── minute (0-59)
│ ┌───────── hour (0-23)
│ │ ┌───────── day of month (1-31)
│ │ │ ┌───────── month (1-12)
│ │ │ │ ┌───────── day of week (0-6, Sunday=0)
│ │ │ │ │
* * * * *

Special Characters

CharacterMeaningExample
*Any value* * * * * → every minute
,List of values1,15 * * * * → minute 1 and 15
-Range1-5 * * * * → minutes 1 through 5
/Step*/15 * * * * → every 15 minutes

Common Cron Expressions

Here are the schedules developers use most often:

ExpressionDescription
* * * * *Every minute
*/5 * * * *Every 5 minutes
*/15 * * * *Every 15 minutes
0 * * * *Every hour (at minute 0)
0 */2 * * *Every 2 hours
0 0 * * *Daily at midnight
0 9 * * *Daily at 9:00 AM
0 9 * * 1-5Weekdays at 9:00 AM
0 0 * * 0Weekly (Sunday at midnight)
0 0 1 * *Monthly (1st at midnight)
0 0 1 1 *Yearly (January 1st at midnight)

Reading Cron Expressions

Let’s break down a few examples:

30 9 * * 1-5

  • 30 — At minute 30
  • 9 — Of hour 9 (9:30 AM)
  • * — Every day of the month
  • * — Every month
  • 1-5 — Monday through Friday

Result: “At 9:30 AM, Monday through Friday”

0 */4 * * *

  • 0 — At minute 0
  • */4 — Every 4th hour (0, 4, 8, 12, 16, 20)
  • * — Every day
  • * — Every month
  • * — Every day of week

Result: “Every 4 hours, at the start of the hour”

0 0 1,15 * *

  • 0 — At minute 0
  • 0 — At hour 0 (midnight)
  • 1,15 — On the 1st and 15th
  • * — Every month
  • * — Every day of week

Result: “At midnight on the 1st and 15th of every month”

Platform-Specific Variations

Standard Crontab (Linux/macOS)

Uses the 5-field format described above. Edit with crontab -e:

# Run backup daily at 2:30 AM
30 2 * * * /usr/local/bin/backup.sh

# Clear temp files every Sunday at midnight
0 0 * * 0 rm -rf /tmp/cache/*

GitHub Actions

Uses the same 5-field format in workflow files:

on:
  schedule:
    - cron: '0 9 * * 1'  # Every Monday at 9:00 AM UTC

Note: GitHub Actions uses UTC time exclusively.

Kubernetes CronJobs

Same 5-field syntax:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: daily-report
spec:
  schedule: "0 6 * * *"  # Daily at 6:00 AM

AWS CloudWatch / EventBridge

Uses a 6-field format with seconds and slightly different syntax:

cron(0 9 ? * MON-FRI *)

Fields: minutes, hours, day-of-month, month, day-of-week, year. Uses ? for “no specific value.”

How to Use Our Cron Expression Parser

  1. Enter a cron expression in the input field (e.g., */15 9-17 * * 1-5)
  2. Read the human-readable description below the input
  3. Check the next 5 scheduled run times to verify the schedule
  4. Use preset buttons to quickly fill common schedules
  5. Reference the field labels (minute, hour, day, month, weekday) above the input

Tips

  • Hover over the field labels to see what each position means
  • Try modifying one field at a time to understand how changes affect the schedule
  • The “next runs” feature shows actual upcoming dates, making it easy to verify your schedule
  • Use preset buttons as starting points and customize from there

Common Mistakes

Forgetting the Minute Field

# Wrong — runs 60 times per hour!
* 9 * * *    → Every minute of the 9 AM hour

# Right — runs once at 9:00 AM
0 9 * * *    → At 9:00 AM

Confusing Day of Week Numbers

  • 0 or 7 = Sunday (both work on most systems)
  • 1 = Monday
  • 5 = Friday

Timezone Assumptions

Cron uses the server’s local timezone (or UTC for cloud services). Always document which timezone your cron schedule expects.

Frequently Asked Questions

What’s the minimum interval for cron? Standard cron supports per-minute granularity. For sub-minute scheduling, you’ll need a different tool.

Can I use month and day names? Some implementations support JAN-DEC for months and SUN-SAT for days, but numeric values are more portable.

How do day-of-month and day-of-week interact? In standard cron, if both are set to specific values (not *), the job runs when either condition is met — this is a common source of confusion.


Try our free Cron Expression Parser to build and verify cron schedules instantly.

Try Ghost Image Hub

The Chrome extension that makes managing your Ghost blog images a breeze.

Learn More