Cron on the last weekday of the month (LW)
The last weekday of the month in cron is LW in Quartz and Spring, such as 0 0 9 LW * ?; this page lists the next runs, calculated in your browser.
Unix cron has no L or W. Run on days 26 to 31, Monday to Friday, and check in the command that no later weekday exists this month; or use a scheduler with LW.
0 0 9 LW * ?
AWS documents L and W for day of month separately, but not the LW combination, so test cron(0 9 LW * ? *) in your account before relying on it.
Read by our parser as: At 9:00 AM, on the last weekday (Mon-Fri) of the month. Open in the cron checker
Next 10 runs
Calculating in your browser...
- 1
- 2
- 3
At a glance
- Accepts
- Nothing to enter - the schedule is preset on the page
- Outputs
- The expression in Unix, Quartz/Spring and AWS form, plus its next 10 run times
- Where it runs
- Entirely in your browser, on your device
- What leaves your device
- Nothing - what you type stays in this tab
- Limits
- Run times use your browser's timezone or UTC; real schedulers can start a run late
- Account
- Not required - there is no sign-up
- Price
- Free, with no watermark and no usage cap
- Made by
- Visrut
What it means
LW means the last weekday (Monday to Friday) of the month. If the month ends on a Saturday, it's that Friday; if it ends on a Sunday, the Friday two days earlier. 0 0 9 LW * ? runs at 9:00 on that day in Quartz and Spring.
When this is the right schedule
Use it when the job needs a working day at month end: payroll exports, end-of-month reports someone must review, the last chance to file something.
When to pick something else
Look elsewhere when you need business days (excluding public holidays), which W doesn't know about; it only skips Saturdays and Sundays.
Things to watch
How W picks a day
Quartz's 15W is the weekday nearest the 15th: Saturday the 15th moves to Friday the 14th, Sunday the 15th to Monday the 16th. It never crosses into another month, so 1W on a Saturday 1st becomes Monday the 3rd.
Can't combine with Unix's OR
In Unix cron, 0 9 26-31 * 1-5 doesn't mean "a weekday from the 26th"; it means days 26 to 31 or any weekday, because both day fields are set. That runs nearly every day.
Spring and Quartz agree here
Spring documents 0 0 0 LW * * as "last weekday of the month at midnight", the same meaning as Quartz. With ? in day of week the expression works in both.
Frequently asked questions
What does LW mean in a cron expression?
The last weekday (Monday to Friday) of the month, in the day-of-month field of Quartz, Spring and AWS cron.
Does W skip public holidays?
No. It only avoids Saturdays and Sundays. Holidays need a calendar, which Quartz supports separately.