Every Weekday Cron Expression
Runs Monday through Friday at midnight.
0 0 * * 1-5 in POSIX cron
Expression
0 0 * * 1-5Try it in the tester →Field Breakdown
How It Works
Day-of-week field uses the range `1-5` — Monday (1) through Friday (5). Saturday (6) and Sunday (0) are skipped.
Example Run Times
- Mon 00:00:00
- Tue 00:00:00
- Wed 00:00:00
- Thu 00:00:00
- Fri 00:00:00
Frequently Asked Questions
Why does Sunday have two values (0 and 7)?
Vixie cron and most POSIX clones accept both 0 and 7 for Sunday. Quartz uses 1=Sun – 7=Sat instead.
Can I use `MON-FRI` instead of `1-5`?
Yes on Vixie cron, GitHub Actions, and AWS EventBridge. Standard POSIX cron only accepts numeric values.
0 0 * * 1-5 in Quartz / Spring
Midnight Monday through Friday, skipping weekends — roughly 260 firings a year. The eye-catcher is the day-of-week range: Quartz numbers Sunday as 1, so weekdays are 2-6, not the Unix 1-5.
Quartz / Spring expression
0 0 0 ? * 2-6Try it in the tester →At 00:00:00 on Mon, Tue, Wed, Thu, Fri
Unix / POSIX equivalent: 0 0 * * 1-5
@Scheduled parser uses 0–7 with Monday = 1 — numeric day values mean different days in the two. The day names (MON, FRI, MON-FRI) are identical in both and safer to copy between them.Field Breakdown
Using It with Quartz / Spring
Weekday-only midnight runs front-load the business day: staging the morning's work queues, generating trading-day reports, or pre-warming caches that nobody needs on Saturday. The string drops into @Scheduled(cron = "0 0 0 ? * 2-6") or a Quartz CronTrigger as usual, but note the structural flip — here the ? lives in day-of-month and the constraint sits in day-of-week, the mirror image of date-based schedules. Many teams write the range as MON-FRI instead of 2-6 specifically to defuse the numbering confusion in code review.
Quartz-Specific Notes
- →Quartz day-of-week runs 1-7 with SUN=1, so 2-6 is Monday-Friday; porting a Unix 1-5 range verbatim would silently include Sunday and drop Friday.
- →Day names MON-FRI are first-class Quartz syntax and produce the identical schedule with zero ambiguity.
- →Exactly one of the two day fields must be ? — here it's day-of-month, because the rule is weekday-driven rather than date-driven.
Frequently Asked Questions
Why is the day-of-week range 2-6 instead of 1-5?
Quartz starts the week at Sunday=1, unlike Unix cron where Monday=1 (or Sunday=0). Monday is therefore 2 and Friday is 6. Writing MON-FRI sidesteps the whole issue.
How do I exclude public holidays too?
Cron syntax can't express holidays. Quartz's answer is a HolidayCalendar (or AnnualCalendar) registered with the scheduler and attached to the trigger via modifiedByCalendar() — excluded dates are then skipped automatically.
0 0 * * 1-5 in AWS EventBridge
Midnight UTC, Monday through Friday only — but notice the day-of-week range reads 2-6, not 1-5. EventBridge numbers days with Sunday as 1, so Monday is 2 and Friday is 6, the single most common conversion mistake when porting Unix crontabs to AWS.
AWS EventBridge expression
cron(0 0 ? * 2-6 *)Try it in the tester →At 00:00 UTC on Mon, Tue, Wed, Thu, Fri
Unix / POSIX equivalent: 0 0 * * 1-5
Field Breakdown
Using It with AWS EventBridge
Use the expression as a rule's ScheduleExpression to gate weekday-only automation: starting non-production EC2 or RDS instances for the workweek via a Lambda, launching the overnight build of internal datasets nobody reads on Saturday, or triggering Step Functions pipelines whose upstream sources only publish on business days. Skipping weekends cuts this rule to roughly 261 runs per year instead of 365, which matters when each run launches a costly ECS task.
AWS-Specific Notes
- →2-6 maps to MON-FRI because EventBridge uses 1-7 with SUN=1; the name form cron(0 0 ? * MON-FRI *) is equivalent and far harder to misread.
- →The ? now sits in day-of-month — when day-of-week carries a real constraint, day-of-month must be the ?, never *.
- →Weekday gating is calendar-based, not holiday-aware; the rule still fires on Christmas if it falls on a Tuesday. Holiday logic belongs in the target.
- →Midnight UTC Monday is still Sunday evening in the US, so the "weekday" boundary may not match your local working week.
Frequently Asked Questions
Why doesn't 1-5 mean Monday to Friday on EventBridge like it does in Linux cron?
Linux cron counts Sunday as 0 (or 7), so 1-5 is Mon-Fri. EventBridge counts Sunday as 1, shifting everything: Mon-Fri becomes 2-6. Using the names MON-FRI sidesteps the off-by-one entirely.
Can I write cron(0 0 * * 2-6 *) with a * in day-of-month?
No — the validator rejects expressions where both day fields carry values; one of them must yield with ?. With both populated (even as *), PutRule throws a ValidationException.
How do I skip public holidays too?
EventBridge cron has no holiday concept. Either check a holiday calendar at the top of the target function and exit early, or front the job with a Step Functions choice state that consults a holidays table.
0 0 * * 1-5 in GitHub Actions
Midnight UTC, Monday through Friday only — the 1-5 range in the final field uses GitHub's 0-6 day numbering where Sunday is 0. Five runs per week instead of seven, for automation that has no business firing on weekends.
GitHub Actions expression
0 0 * * 1-5Try it in the tester →At 00:00 UTC on Mon, Tue, Wed, Thu, Fri
Unix / POSIX equivalent: 0 0 * * 1-5
Field Breakdown
Using It with GitHub Actions
Committed as on: schedule: - cron: "0 0 * * 1-5" in workflow YAML, the weekday-only pattern fits business-rhythm jobs: refreshing data that upstream systems only update on trading days, opening a daily triage issue nobody would look at on Saturday, or running cost reports against cloud accounts that idle over the weekend. One subtlety worth knowing before relying on it: midnight Monday UTC is still Sunday evening across the Americas, so what reads as a weekday job can land in your weekend.
GitHub-Specific Notes
- →Day-of-week runs 0-6 with Sunday as 0 here, and 7 is also accepted for Sunday — so 1-5 is unambiguously Monday through Friday, matching standard POSIX behavior.
- →Weekday-ness is evaluated in UTC: the Monday 00:00 UTC run occurs at 19:00 Sunday in US Eastern (EST), which can surprise teams expecting strictly Monday-to-Friday local behavior.
- →Each of the five weekly runs hits the congested 00:00 slot; a weekday schedule like "23 5 * * 1-5" keeps the business-days-only logic with much friendlier queue times.
Frequently Asked Questions
Does GitHub Actions support MON-FRI instead of 1-5?
Yes — GitHub documents both numeric 0-6 (Sunday = 0) and the SUN-SAT names, so 0 0 * * MON-FRI works. Numeric 1-5 is the more portable choice if the same string ever moves to another cron dialect.
Why did my weekday-only workflow run on Sunday?
It almost certainly ran at 00:00 UTC Monday, which is Sunday afternoon or evening in the Americas. The schedule is correct in UTC; shift the hour if you need the run to fall on a local weekday.