Cron Expression Parser

Overview

The cron expression parser accepts a cron expression and outputs a human-readable description, an ASCII field diagram, the next 5 upcoming executions, and the 5 most recent past executions. It's useful for verifying an expression's logic before deploying a scheduled task, and for troubleshooting schedules that aren't firing as expected.

5-field vs. 6-field format

Two formats are supported:

  • 5 fields (minute hour day month weekday) — standard Linux crontab syntax
  • 6+ fields (second minute hour day month weekday) — used by Spring, Quartz, and other frameworks that need second-level granularity

The tool auto-detects which format you're using based on field count.

Special characters L, #, and ?

These three go beyond the basic *, ,, -, / operators and control patterns that repeat monthly:

L (Last) — in the day field, means the last day of the month; in the weekday field, means the last occurrence of that weekday in the month:

0 18 L * *       # Every month's last day at 18:00
30 10 * * 5L     # Last Friday of every month at 10:30

# (Nth occurrence) — weekday field only, format weekday#n, where 1 = Sunday through 7 = Saturday:

0 10 ? * 2#3     # 3rd Tuesday of every month at 10:00
0 9  ? * 1#1     # 1st Sunday of every month at 09:00

? — in the day or weekday field, means "unspecified" — avoids ambiguity when the other field is already set:

30 9 ? * MON-FRI   # Weekdays at 09:30 (day field unspecified)
0 12 15 * ?        # Every month's 15th at 12:00 (weekday unspecified)

Day and weekday set together

By default, when both the day-of-month and day-of-week fields are set (neither is ? or *), the engine treats it as OR — the job fires if either condition is met. This is consistent with most Linux crontab implementations. To ban this and require both to match, the underlying library supports a strict mode. If you're targeting a different scheduler, test the actual behavior in that environment.

Common expression examples

*/5 * * * *        # Every 5 minutes
0 9 * * 1          # Every Monday at 09:00
0 0 1 * *          # 1st of every month at midnight
0 18 L * ?         # Last day of every month at 18:00
0 10 ? * 2#3       # 3rd Tuesday of every month at 10:00
15,45 13 ? 6 Tue   # Every Tuesday in June at 13:15 and 13:45
0-5 13 * * ?       # Every minute from 13:00 to 13:05 daily

Timezone and the H character

The timezone field accepts IANA names like America/New_York or Asia/Tokyo. The parser handles daylight saving transitions, so displayed times reflect the local clock in that zone.

H is a randomized-but-stable placeholder used in some CI scheduling systems (like Jenkins). Without a hash seed, its resolved value will vary between environments, so two machines may not fire at the same time. Use an explicit value in production when consistent timing is required.