Lesson 2 of 6

Syntax & Fields

A cron expression is just five fields separated by spaces, each one answering a different question about "when." Once you can read the five slots in order, you can read almost any cron expression you'll ever encounter.

💡 The Bottom Line

A cron expression always has five fields, in this fixed order: minute, hour, day of month, month, and day of week. Each field either names a specific value or uses * to mean "every value is fine here."

The five fields, in order

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

Read left to right, that's: minute, hour, day-of-month, month, day-of-week. Every cron expression, no matter how complex it looks, is built from exactly these five slots — nothing more.

📋 The five fields, with their allowed values

  • Minute059
  • Hour023 (24-hour clock, no AM/PM)
  • Day of month131
  • Month112 (1 = January)
  • Day of week06 (0 = Sunday — see Lesson 6 for a gotcha here)

A first concrete example

0 9 * * *

Reading it field by field: minute 0, hour 9, then *, *, * for day-of-month, month, and day-of-week — meaning "don't restrict those, any value is fine." Put together: at minute 0 of hour 9, every day of every month, on every day of the week — in plain English, every day at 9:00am.

⚠️ Watch Out

The hour field is 24-hour time, not 12-hour AM/PM. 9 means 9am, but 5pm is 17, not 5. Writing 0 5 * * * when you meant 5pm is one of the most common first-time cron mistakes — it actually schedules the job for 5am.

🙋 There Are No Dumb Questions

Q: What happens if I leave a field blank instead of using *?
A: You can't — a standard cron expression always needs all five fields present and space-separated. Leaving one out isn't "default to every value," it's a malformed expression that most parsers will reject outright. Use * explicitly whenever you mean "any value is fine here."

🔧 Try It Yourself

Before reading further in this track, try to write the cron expression for "every day at 6:30pm" using just what you've learned so far: minute, hour (remember 24-hour time), then three asterisks. Check your answer: it should be 30 18 * * *.

✅ Quick Check

In the expression 0 9 * * *, what does the second field (9) represent?


Next up: a set of common, ready-to-use schedules that will cover most of the recurring jobs you'll ever need to write.

← Back to
Next →