What is a Cron Expression?
A cron expression is a string that defines a schedule. It tells CronSynth *when* to trigger your webhook.
CronSynth uses the standard 5-field cron format:
┌───────────── minute (0 - 59)
│ ┌─────────── hour (0 - 23)
│ │ ┌───────── day of month (1 - 31)
│ │ │ ┌─────── month (1 - 12)
│ │ │ │ ┌───── day of week (0 - 6, Sunday = 0)
│ │ │ │ │
- * * * *
Each field specifies when the schedule should match.
---Field Values
| Field | Allowed Values | Special Characters | |-------|----------------|-------------------| | Minute | 0-59 | * , - / | | Hour | 0-23 | * , - / | | Day of Month | 1-31 | * , - / | | Month | 1-12 | * , - / | | Day of Week | 0-6 (Sun=0) | * , - / | ---Special Characters
Asterisk (*)Matches all values. * * * * * means "every minute of every hour of every day."
Specifies multiple values. 0,30 * * * * means "at minute 0 and minute 30."
Specifies a range. 0 9-17 * * * means "at minute 0 during hours 9 through 17."
Specifies intervals. */5 * * * * means "every 5 minutes."
Common Examples
Every X Minutes
| Expression | Description | |------------|-------------| |* * * * * | Every minute |
| */5 * * * * | Every 5 minutes |
| */10 * * * * | Every 10 minutes |
| */15 * * * * | Every 15 minutes |
| */30 * * * * | Every 30 minutes |
Hourly
| Expression | Description | |------------|-------------| |0 * * * * | Every hour at :00 |
| 30 * * * * | Every hour at :30 |
| 0 */2 * * * | Every 2 hours |
| 0 */4 * * * | Every 4 hours |
| 0 */6 * * * | Every 6 hours |
Daily
| Expression | Description | |------------|-------------| |0 0 * * * | Daily at midnight (00:00 UTC) |
| 0 6 * * * | Daily at 6 AM UTC |
| 0 12 * * * | Daily at noon UTC |
| 0 18 * * * | Daily at 6 PM UTC |
| 30 9 * * * | Daily at 9:30 AM UTC |
Weekly
| Expression | Description | |------------|-------------| |0 0 * * 0 | Weekly on Sunday at midnight |
| 0 0 * * 1 | Weekly on Monday at midnight |
| 0 9 * * 1 | Weekly on Monday at 9 AM UTC |
| 0 0 * * 5 | Weekly on Friday at midnight |
| 0 17 * * 5 | Weekly on Friday at 5 PM UTC |
Monthly
| Expression | Description | |------------|-------------| |0 0 1 * * | First day of month at midnight |
| 0 0 15 * * | 15th of month at midnight |
| 0 9 1 * * | First day of month at 9 AM UTC |
| 0 0 1,15 * * | 1st and 15th of month |
Weekdays / Weekends
| Expression | Description | |------------|-------------| |0 9 * * 1-5 | Weekdays at 9 AM UTC |
| 0 0 * * 1-5 | Weekdays at midnight |
| 0 10 * * 0,6 | Weekends at 10 AM UTC |
| */30 * * * 1-5 | Every 30 min on weekdays |
---
Real-World Examples
Trading Bot: Check prices every 5 minutes during trading hours*/5 9-16 * * 1-5
Every 5 minutes, hours 9-16 (9 AM to 4 PM), Monday through Friday.
DeFi: Harvest yields daily at 3 AM UTC (low gas)0 3 * * *
At 3:00 AM UTC every day.
Monitoring: Health check every 10 minutes*/10 * * * *
At minutes 0, 10, 20, 30, 40, 50 of every hour.
Reports: Weekly summary every Monday at 9 AM0 9 * * 1
At 9:00 AM UTC every Monday.
Data Pipeline: Sync every 4 hours0 */4 * * *
At minute 0 of hours 0, 4, 8, 12, 16, 20.
Content: Post three times daily0 8,12,18 * * *
At 8 AM, 12 PM, and 6 PM UTC.
---CronSynth Constraints
Minimum Interval: 1 MinuteCronSynth's scheduler runs every minute. You cannot schedule faster than once per minute.
❌ */30 * * * * does NOT mean "every 30 seconds" — it means "every 30 minutes"
✅ * * * * * is the fastest: every minute
CronSynth interprets all times as UTC. If you need a different timezone:
1. Convert your desired local time to UTC
2. Use the UTC time in your cron expression
Example: 9 AM Eastern (EST/EDT) ≈ 14:00 or 13:00 UTC depending on daylight saving.
Exactly 5 FieldsCronSynth requires exactly 5 fields:
❌ * * * * (4 fields) — rejected
❌ * * * * * * (6 fields) — rejected
✅ * * * * * (5 fields) — accepted
Timezone Conversion Examples
| Local Time | Timezone | UTC Expression | |------------|----------|----------------| | 9 AM | US Eastern (EST) |0 14 * * * |
| 9 AM | US Eastern (EDT) | 0 13 * * * |
| 9 AM | US Pacific (PST) | 0 17 * * * |
| 9 AM | US Pacific (PDT) | 0 16 * * * |
| 9 AM | UK (GMT) | 0 9 * * * |
| 9 AM | UK (BST) | 0 8 * * * |
| 9 AM | Central Europe (CET) | 0 8 * * * |
| 9 AM | Central Europe (CEST) | 0 7 * * * |
| 9 AM | Japan (JST) | 0 0 * * * |
Note: Daylight saving time changes the UTC offset. Either update your cron expression seasonally or use a fixed UTC time.
---
Testing Your Expression
Before registering a schedule, verify your cron expression:
Online Tools:- [crontab.guru](https://crontab.guru/) — Visual cron editor
- [cronitor.io/cron-reference](https://cronitor.io/cron-reference) — Examples and validator
import parser from 'cron-parser';
function validateCron(expression: string): boolean {
try {
const interval = parser.parseExpression(expression);
console.log('Next 5 executions:');
for (let i = 0; i < 5; i++) {
console.log(interval.next().toString());
}
return true;
} catch (e) {
console.error('Invalid expression:', e.message);
return false;
}
}
validateCron('*/5 * * * *');
// Next 5 executions:
// Tue Dec 03 2024 10:05:00 GMT+0000
// Tue Dec 03 2024 10:10:00 GMT+0000
// Tue Dec 03 2024 10:15:00 GMT+0000
// Tue Dec 03 2024 10:20:00 GMT+0000
// Tue Dec 03 2024 10:25:00 GMT+0000
---
Quick Reference Card
┌─────────────────────────────────────────────────┐
│ CRON QUICK REFERENCE │
├─────────────────────────────────────────────────┤
│ Every minute: * * * * * │
│ Every 5 minutes: */5 * * * * │
│ Every hour: 0 * * * * │
│ Every day at noon: 0 12 * * * │
│ Every Monday 9AM: 0 9 * * 1 │
│ First of month: 0 0 1 * * │
│ Weekdays only: 0 9 * * 1-5 │
├─────────────────────────────────────────────────┤
│ Fields: minute hour day month weekday │
│ All times in UTC │
│ Minimum interval: 1 minute │
└─────────────────────────────────────────────────┘
---
Common Mistakes
Mistake 1: Wrong field order❌ 0 0 * 1 * — Trying to schedule "first of month" but day and month are swapped
✅ 0 0 1 * * — Correct: day of month is field 3
❌ */30 * * * * — Expecting every 30 seconds
✅ This actually means every 30 minutes
Mistake 3: Forgetting UTC❌ 0 9 * * * — Expecting 9 AM local time
✅ This is 9 AM UTC — convert your local time first
Mistake 4: Using 7 for Sunday❌ 0 0 * * 7 — Some systems use 7 for Sunday, CronSynth doesn't
✅ 0 0 * * 0 — Sunday is 0
Need Help?
- [User Guide](/docs/guide) — Full integration walkthrough
- [API Reference](/docs/api) — Endpoint documentation
- [Troubleshooting](/docs/guide#troubleshooting) — Common issues