Cron Syntax
5-field expression format
Timezone Support
UTC or local timezone
Visual Builder
Build expressions visually
Expression Testing
Preview next run times
Cron Expression Syntax
A cron expression consists of 5 fields separated by spaces. Each field represents a unit of time and determines when the job should run.
┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
│ │ │ │ │
* * * * *Field Definitions
| Property | Type | Description |
|---|---|---|
Minute | 0-59 | Minute of the hour (0 = top of hour) |
Hour | 0-23 | Hour of the day (0 = midnight, 23 = 11pm) |
Day of Month | 1-31 | Day of the month (1 = first day) |
Month | 1-12 | Month of the year (1 = January, 12 = December) |
Day of Week | 0-6 | Day of the week (0 = Sunday, 6 = Saturday) |
Special Characters
Use special characters to create flexible scheduling patterns:
| Property | Type | Description |
|---|---|---|
* | wildcard | Matches any value (e.g., every minute, every hour) |
, | list | Specifies multiple values (e.g., 1,3,5 = Mon, Wed, Fri) |
- | range | Specifies a range (e.g., 1-5 = Monday through Friday) |
/ | step | Specifies increments (e.g., */15 = every 15 minutes) |
// Examples of special characters
// Asterisk (*) - every value
* * * * * // Every minute
// Comma (,) - multiple specific values
0 9,12,18 * * * // At 9am, 12pm, and 6pm
// Hyphen (-) - range of values
0 9 * * 1-5 // Weekdays at 9am (Monday through Friday)
// Slash (/) - step values
*/15 * * * * // Every 15 minutes
0 */4 * * * // Every 4 hoursCommon Cron Patterns
Reference these commonly used patterns for typical scheduling needs:
| Property | Type | Description |
|---|---|---|
* * * * * | pattern | Every minute |
*/5 * * * * | pattern | Every 5 minutes |
*/15 * * * * | pattern | Every 15 minutes |
0 * * * * | pattern | Every hour (at minute 0) |
0 */2 * * * | pattern | Every 2 hours |
0 0 * * * | pattern | Daily at midnight |
0 9 * * * | pattern | Daily at 9:00 AM |
0 9 * * 1-5 | pattern | Weekdays at 9:00 AM |
0 0 * * 0 | pattern | Weekly on Sunday at midnight |
0 6 * * 1 | pattern | Weekly on Monday at 6:00 AM |
0 0 1 * * | pattern | Monthly on the 1st at midnight |
0 0 1 1 * | pattern | Yearly on January 1st at midnight |
Pattern Builder
Timezone Handling
By default, all cron expressions are evaluated in UTC. You can specify a timezone to run jobs in local time.
import { platform } from '@/lib/platform'
// Runs at 9am UTC every day
const job = await platform.jobs.schedule({
url: 'https://myapp.com/api/jobs/daily-report',
cron: '0 9 * * *',
// No timezone specified = UTC
})Daylight Saving Time
Testing Cron Expressions
Preview when your cron expression will run next using the SDK or console.
import { platform } from '@/lib/platform'
// Get the next 5 run times for a cron expression
const nextRuns = await platform.jobs.previewCron({
cron: '0 9 * * 1-5',
timezone: 'America/New_York',
count: 5,
})
console.log(nextRuns)
// [
// '2024-01-22T14:00:00Z', // Monday 9am EST
// '2024-01-23T14:00:00Z', // Tuesday 9am EST
// '2024-01-24T14:00:00Z', // Wednesday 9am EST
// '2024-01-25T14:00:00Z', // Thursday 9am EST
// '2024-01-26T14:00:00Z', // Friday 9am EST
// ]Scheduling via SDK
Create recurring jobs programmatically using the SDK.
import { platform } from '@/lib/platform'
// Schedule a daily report
export async function scheduleDailyReport(orgId: string) {
const job = await platform.jobs.schedule({
url: 'https://myapp.com/api/jobs/generate-report',
cron: '0 6 * * *', // 6am UTC daily
body: {
orgId,
type: 'daily',
},
retries: {
maxAttempts: 3,
backoff: 'exponential',
},
metadata: {
name: 'Daily Report',
orgId,
},
})
return job
}
// Schedule hourly cleanup
export async function scheduleCleanup() {
return platform.jobs.schedule({
url: 'https://myapp.com/api/jobs/cleanup',
cron: '0 * * * *', // Every hour
timeout: 300, // 5 minute timeout
metadata: {
name: 'Hourly Cleanup',
},
})
}
// Schedule weekly digest on Mondays
export async function scheduleWeeklyDigest(userId: string, timezone: string) {
return platform.jobs.schedule({
url: 'https://myapp.com/api/jobs/weekly-digest',
cron: '0 9 * * 1', // Monday 9am
timezone,
body: { userId },
metadata: {
name: 'Weekly Digest',
userId,
},
})
}Job Metadata
metadata field to store additional information about your job. This makes it easier to identify and filter jobs in the console.Viewing Scheduled Jobs
Manage and monitor your scheduled jobs through the console or SDK.
import { platform } from '@/lib/platform'
// List all cron jobs
const cronJobs = await platform.jobs.list({
type: 'cron',
status: 'active',
})
for (const job of cronJobs) {
console.log({
id: job.id,
cron: job.cron,
timezone: job.timezone,
nextRunAt: job.nextRunAt,
lastRunAt: job.lastRunAt,
status: job.status,
})
}Console Features
The Sylphx console provides a visual interface for managing cron jobs:
Visual Schedule
See upcoming runs in a calendar view with timezone conversion
Run History
View execution history, duration, and success/failure rates
Manual Trigger
Trigger a cron job manually for testing without waiting for schedule
Quick Actions
Pause, resume, edit, or delete jobs directly from the dashboard
Best Practices
Use Descriptive Metadata
Avoid Minute 0
5 * * * *) to distribute load.