Resources / Serverless
Cron expression examples: a cheat sheet for every schedule
Cron syntax explained with copy-paste examples — every 5 minutes, hourly, weekdays at 9am, the first of the month — plus time zones and common mistakes.
A cron expression is five fields that describe when something runs:
┌───────────── minute (0–59)
│ ┌─────────── hour (0–23)
│ │ ┌───────── day of month (1–31)
│ │ │ ┌─────── month (1–12 or JAN–DEC)
│ │ │ │ ┌───── day of week (0–6, Sunday = 0, or SUN–SAT)
│ │ │ │ │
* * * * *
Special characters
| Symbol | Means | Example |
|---|---|---|
* | Every value | * in hours = every hour |
, | A list | 1,15 = the 1st and the 15th |
- | A range | 1-5 = Monday to Friday |
/ | A step | */15 = every 15 |
Copy-paste examples
| Schedule | Cron |
|---|---|
| Every 5 minutes | */5 * * * * |
| Every 15 minutes | */15 * * * * |
| Every hour, on the hour | 0 * * * * |
| Every 2 hours | 0 */2 * * * |
| Every day at midnight | 0 0 * * * |
| Every day at 9:30am | 30 9 * * * |
| Weekdays at 9am | 0 9 * * 1-5 |
| Every Monday at 8am | 0 8 * * 1 |
| Twice a day (9am and 5pm) | 0 9,17 * * * |
| First day of every month at 6am | 0 6 1 * * |
| Every Sunday at 11pm | 0 23 * * 0 |
| First Monday of the month* | 0 9 1-7 * 1 (see below) |
| Every quarter (Jan, Apr, Jul, Oct) at midnight on the 1st | 0 0 1 1,4,7,10 * |
The gotchas
- *Day of month and* day of week. In standard cron, when both are restricted the job runs when either** matches.
0 9 1-7 * 1therefore runs on days 1–7 and on every Monday. To get "first Monday", schedule0 9 * * 1and checkdate <= 7in code. - Time zones. Classic cron uses the server's time zone, often UTC. "9am" for a team in Berlin is
0 8 * * *in UTC in winter and0 7 * * *in summer. Prefer a scheduler that takes a time zone. - Daylight saving. A job at 2:30am may run twice or not at all on the night clocks change. Avoid 1–3am for jobs that must run exactly once.
- Overlapping runs. If a run takes longer than the interval, the next one starts anyway. Make jobs idempotent, or use a lock.
- Silent failures. A cron job that fails at 3am tells nobody. Log every run and alert on errors.
Nonstandard extensions
Some schedulers add a seconds field (six fields), or shortcuts like @daily, @hourly, L (last day) and # (1#1 = first Monday). They aren't portable — check what your scheduler supports.
Schedules on Wisp
On Wisp you can skip the syntax: describe the schedule — "every weekday at 9am Berlin time" — and Wisp writes the task and turns it into a cron expression in your time zone. You can also type a cron expression in the task's settings. Schedules run the published version, at most every 5 minutes, and every run is logged with alerts when it fails. See scheduled jobs without a server.
Try it: Cron expression generator · Every common cron schedule, explained
Build it with Wisp — describe an API, get it live.