Salesforce CRON Expression Builder
Build Salesforce CRON expressions visually for System.schedule().
Select days, hours, and minutes with clickable controls, preview the next 5 run times,
and copy a ready-to-use Apex code snippet — all in your browser.
- ✓ Salesforce 7-field CRON format
- ✓ Visual day, hour, and minute pickers
- ✓ Next 5 run times preview
- ✓ Copy-ready Apex code snippet
- ✓ 10 common presets
- ✓ Decode & validate existing expressions
- ✓ L, W, # notation support
Advanced — Edit raw fields
System.schedule('My Scheduled Job', '0 0 0 ? * MON-FRI *', new MySchedulable());Salesforce CRON Field Reference
| Field | Values | Special |
|---|---|---|
| Seconds | 0–59 | * , - |
| Minutes | 0–59 | * , - |
| Hours | 0–23 | * , - |
| Day-of-Month | 1–31 | * , - ? L W |
| Month | 1–12 or JAN–DEC | * , - |
| Day-of-Week | 1–7 or SUN–SAT | * , - ? L # |
| Year | 1970–2099 | * , - |
? — No specific value. Required in either Day-of-Month or Day-of-Week (not both).
L — Last. "L" in Day-of-Month = last day of month. "FRIL" in Day-of-Week = last Friday.
W — Nearest weekday. "15W" = nearest weekday to the 15th.
# — Nth occurrence. "MON#2" = second Monday of the month.
Frequently Asked Questions
What is a Salesforce CRON expression?
A Salesforce CRON expression is a 7-field string that defines when a scheduled job runs. The fields are: Seconds, Minutes, Hours, Day-of-Month, Month, Day-of-Week, and Year. It is used with System.schedule() in Apex to schedule batch jobs, queueable jobs, and other automated processes. For example, 0 0 6 ? * MON-FRI * means "every weekday at 6:00 AM."
How is Salesforce CRON different from standard UNIX cron?
Salesforce CRON has 7 fields instead of 5 — it adds a Seconds field at the start and a Year field at the end. It also requires exactly one of Day-of-Month or Day-of-Week to be set to ? (question mark), and supports special characters like L (last), W (nearest weekday), and # (nth day of week). Standard UNIX cron doesn't have seconds, year, or these special characters.
How do I schedule an Apex job in Salesforce?
Use System.schedule() with three parameters: a job name, a CRON expression string, and an instance of a class that implements the Schedulable interface. For example: System.schedule('Daily Cleanup', '0 0 6 * * ?', new MyCleanupJob()); schedules the job to run daily at 6 AM. You can schedule jobs from the Developer Console, an Apex script, or a deployment.
What does the question mark (?) mean in a CRON expression?
The question mark means "no specific value." In Salesforce, exactly one of Day-of-Month or Day-of-Week must be set to ? because you cannot specify both simultaneously. If you want to schedule by day of week (e.g., every Monday), set Day-of-Month to ?. If you want to schedule by date (e.g., the 1st of every month), set Day-of-Week to ?.
What do L, W, and # mean in Salesforce CRON?
L means "last" — in Day-of-Month it triggers on the last day of the month; FRIL in Day-of-Week means the last Friday of the month. W means "nearest weekday" — 15W fires on the nearest weekday to the 15th (Friday the 14th if the 15th is Saturday). # means the Nth occurrence of a day — MON#2 means the second Monday of the month.
Can I schedule a job to run every 5 minutes in Salesforce?
Salesforce does not support the / interval syntax in CRON expressions. To approximate "every 5 minutes," list the specific minute values: 0 0,5,10,15,20,25,30,35,40,45,50,55 * * * ?. For true near-real-time processing, consider using a scheduled job that enqueues a Queueable, or use Platform Events with Change Data Capture.
Related Salesforce Developer Tools
-
Apex Debug Log Analyzer
Debug your scheduled jobs by analyzing their debug logs — see governor limits, execution timeline, and call tree.
-
SOQL Query Builder
Build SOQL queries to check CronTrigger and AsyncApexJob records for your scheduled jobs.
-
JSON to Apex Generator
Generate Apex wrapper classes for API responses your scheduled jobs process.