WThe W (nearest weekday) character in Quartz cron
A number followed by W means "the weekday nearest to that day of the month". It is how Quartz handles paydays and due dates that fall on weekends.
The rules
- 15W: the weekday closest to the 15th, never leaving the month.
- If the 15th is a Saturday it runs on Friday the 14th; if Sunday, on Monday the 16th.
- 1W on a Saturday runs on Monday the 3rd, because it will not move back into the previous month.
- Only valid in the day-of-month field.
Examples you can copy
0 0 9 15W * ?At 09:00 UTC, on the weekday nearest the 15th of the month. Mid-month payroll on the nearest weekday.
First runs after 1 Jan 2027 (UTC): Fri, 15 Jan 2027, 09:00 ยท Mon, 15 Feb 2027, 09:00 ยท Mon, 15 Mar 2027, 09:00
0 0 9 1W * ?At 09:00 UTC, on the weekday nearest the 1st of the month. First working day of the month, roughly.
First runs after 1 Jan 2027 (UTC): Fri, 01 Jan 2027, 09:00 ยท Mon, 01 Feb 2027, 09:00 ยท Mon, 01 Mar 2027, 09:00
0 0 9 LW * ?At 09:00 UTC, on the last weekday of the month. Last working day of the month.
First runs after 1 Jan 2027 (UTC): Fri, 29 Jan 2027, 09:00 ยท Fri, 26 Feb 2027, 09:00 ยท Wed, 31 Mar 2027, 09:00
0 9 15W * ? *At 09:00 UTC, on the weekday nearest the 15th of the month. EventBridge supports W as well.
First runs after 1 Jan 2027 (UTC): Fri, 15 Jan 2027, 09:00 ยท Mon, 15 Feb 2027, 09:00 ยท Mon, 15 Mar 2027, 09:00
Common mistakes
- Assuming W accounts for public holidays. It only skips Saturdays and Sundays.
- Using a range with W. Only a single day number is allowed (15W, not 10-15W).
Frequently asked questions
Is 1W the same as the first business day?
Mostly. It lands on the first weekday of the month, but ignores holidays.