LThe L (last) character in Quartz cron
L stands for "last". In day-of-month it means the last day of the month, whatever its length. In day-of-week it means the last occurrence of a weekday in the month.
The rules
- L in day-of-month: the last calendar day (28, 29, 30 or 31).
- L-3 in day-of-month: three days before the last day.
- LW in day-of-month: the last weekday (Monday to Friday) of the month.
- nL in day-of-week: the last such weekday, for example 6L is the last Friday in Quartz.
Examples you can copy
0 0 18 L * ?At 18:00 UTC, on the last day of the month. 6 PM on the last day of every month.
First runs after 1 Jan 2027 (UTC): Sun, 31 Jan 2027, 18:00 ยท Sun, 28 Feb 2027, 18:00 ยท Wed, 31 Mar 2027, 18:00
0 0 18 L-3 * ?At 18:00 UTC, on 3 days before the last day of the month. Three days before month end, handy for pre-close reminders.
First runs after 1 Jan 2027 (UTC): Thu, 28 Jan 2027, 18:00 ยท Thu, 25 Feb 2027, 18:00 ยท Sun, 28 Mar 2027, 18:00
0 0 18 LW * ?At 18:00 UTC, on the last weekday of the month. The last working day of the month.
First runs after 1 Jan 2027 (UTC): Fri, 29 Jan 2027, 18:00 ยท Fri, 26 Feb 2027, 18:00 ยท Wed, 31 Mar 2027, 18:00
0 0 12 ? * 6LAt 12:00 UTC, on the last Fri. Noon on the last Friday of every month.
First runs after 1 Jan 2027 (UTC): Fri, 29 Jan 2027, 12:00 ยท Fri, 26 Feb 2027, 12:00 ยท Fri, 26 Mar 2027, 12:00
0 0 12 * * 5LAt 12:00 UTC, on the last Fri. Spring numbers Friday as 5, so the last Friday is 5L.
First runs after 1 Jan 2027 (UTC): Fri, 29 Jan 2027, 12:00 ยท Fri, 26 Feb 2027, 12:00 ยท Fri, 26 Mar 2027, 12:00
Common mistakes
- Using the Quartz weekday number in Spring. Quartz Friday is 6, Spring Friday is 5.
- Expecting L to work in Unix cron, Kubernetes, Jenkins or GitHub Actions. It does not.
Frequently asked questions
How do I run on the last day of the month in plain cron?
Standard cron cannot express it. Schedule days 28-31 and check inside the job that tomorrow is the 1st.
Does LW skip holidays?
No. It only knows about weekends, not public holidays.