How to Write Cron Expressions You Can Actually Trust
Build a five-field cron expression, preview next run times in your timezone, and avoid day-of-month and weekday mistakes.
A cron expression is only useful if the next run matches what you meant. Many outages start with a schedule that looked right in a chat message but fired on the wrong day, skipped a month boundary, or ran in a different timezone than the author expected.
The Haivix Cron Expression Generator helps you build a standard five-field expression (minute, hour, day of month, month, day of week), keep the field builder and text expression in sync, and preview the next five run times in your browser’s local timezone. It does not deploy jobs or talk to your servers.
The five fields, in order
Classic Unix-style cron uses five fields: minute (0–59), hour (0–23), day of month (1–31), month (1–12), and weekday (0–7, where both 0 and 7 mean Sunday). You can use *, lists like 1,3, ranges like 1-5, and steps like */10 or 1-5/2. Month and weekday also accept three-letter aliases such as JAN or MON.
Haivix does not generate six- or seven-field Quartz expressions, seconds fields, years, or special tokens like L, W, #, or ?. If your platform requires those, translate carefully after you leave the tool.
Presets, then customize
Start from a preset when it matches the intent: every 5 or 15 minutes, hourly, daily at 09:00, weekdays at 09:00, Sunday midnight, or the first of the month. Switch to custom when you need an odd interval or a combined constraint.
Edit either the expression string or the per-field controls—the tool keeps them aligned. When you are ready, copy the expression and paste it into the scheduler you actually run.
Day-of-month and day-of-week together
When both day-of-month and day-of-week are restricted (neither is *), many cron implementations treat the schedule as a match if either field matches. If one of those fields is *, the other field controls that dimension. The Haivix FAQ documents this behavior so you are not surprised by “first Monday” style expectations that classic cron does not express the way people speak.
Always preview. Odd combinations can fail the next-run search (the tool searches forward up to about five years of minute resolution). If preview cannot find runs, simplify the expression and try again.
Timezone and platform drift
The next-run preview uses your browser’s local timezone label and toLocaleString formatting. Your production host may use UTC, a container timezone, or a cloud scheduler with its own DST rules. Confirm the same expression on the host before you trust a Monday 09:00 cutover.
After you copy the schedule, wire the job through whatever system you operate—CI, Kubernetes CronJob, cloud scheduler, or an ops script. For API smoke tests after a scheduled job, the API Request Studio can help inspect responses locally. For exporting schedule metadata as tabular data, JSON to CSV is a common companion.
Cron checklist before you ship
Open the Cron Expression Generator, pick a preset or edit fields, read the short description and next runs, then copy the expression. Processing stays in the browser; Haivix does not store or execute your schedule.
- Confirm the field order: minute, hour, day, month, weekday.
- Decide whether the host expects five fields or a Quartz variant.
- Preview at least the next five local runs and sanity-check them.
- Document the intended timezone next to the expression.
- Avoid relying on spoken phrases like “first Monday” unless the platform supports them.
- Retest after DST changes if the job is wall-clock sensitive.