We use cookies to enhance your browsing experience.

Learn More
Back to Blog
Guide2026-02-086 min read

Understanding Cron Syntax: Stop Googling It Every Time

I'm going to admit something that might make some senior developers uncomfortable: I have been writing code professionally for years, and I still used to Google cron syntax every single time I needed to set up a scheduled job. Every. Single. Time.

The five-field format just doesn't stick in my head. Is the first field minutes or hours? Does the day-of-week start at 0 or 1? Is Sunday 0 or 7?

So I sat down one afternoon and actually learned it properly. Here's the mental model that finally made it stick.

The Five Fields

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

The trick that helped me remember: read them as a time stamp, not a countdown. A cron expression reads like a clock: 30 14 * * * means "at 14:30" (2:30 PM). The minute comes first, then the hour — like reading a digital clock backwards.

The Most Common Patterns

Here are the ones you'll actually use 90% of the time:

ExpressionMeaning
`* * * * *`Every minute (probably not what you want)
`0 * * * *`Every hour, on the hour
`0 0 * * *`Midnight, every day
`0 9 * * 1`9 AM every Monday
`0 0 1 * *`Midnight on the 1st of every month
`*/15 * * * *`Every 15 minutes
`0 9-17 * * 1-5`Every hour from 9 AM to 5 PM, weekdays

Special Characters

  • * — any value ("every")
  • , — list: 1,15 means "the 1st and 15th"
  • - — range: 1-5 means "1 through 5"
  • / — step: */5 means "every 5th"

The Gotchas

Timezone: Cron runs in the server's timezone unless you explicitly set it. Deployments to different regions will run at different wall-clock times. Always specify TZ=UTC or your preferred timezone.

Day-of-week: 0 and 7 both mean Sunday in most implementations, but not all. When in doubt, use names: MON, TUE, etc.

Day-of-month + Day-of-week: If you set both, they're OR'd, not AND'd. 0 0 15 * 5 means "midnight on the 15th of any month OR any Friday," not "midnight on the 15th if it's a Friday."

Still Forget?

Honestly, even after learning this, I still double-check complex expressions with a visual tool. There's no shame in that. A cron generator that shows you the human-readable translation of your expression is the fastest way to verify you've got it right. Bookmark one and move on with your life.

Try the Related Tool

Try the tool mentioned in this article right now.

Open Tool
25+Total Tools
Operations
4Languages
100%Privacy

We use cookies to enhance your experience and serve personalized ads.