#The # (nth weekday) character in Quartz cron
In the day-of-week field, day#n means "the nth occurrence of that weekday in the month", such as the second Tuesday.
The rules
- 2#1: the first Monday in Quartz (Monday is 2).
- 6#3: the third Friday.
- n can be 1 to 5. A month with no fifth occurrence simply skips.
- Only valid in the day-of-week field.
Examples you can copy
0 0 9 ? * 2#1At 09:00 UTC, on the 1st Mon. First Monday of the month at 9 AM.
First runs after 1 Jan 2027 (UTC): Mon, 04 Jan 2027, 09:00 ยท Mon, 01 Feb 2027, 09:00 ยท Mon, 01 Mar 2027, 09:00
0 0 9 ? * 3#2At 09:00 UTC, on the 2nd Tue. Second Tuesday of the month, for example a patch Tuesday schedule.
First runs after 1 Jan 2027 (UTC): Tue, 12 Jan 2027, 09:00 ยท Tue, 09 Feb 2027, 09:00 ยท Tue, 09 Mar 2027, 09:00
0 0 9 * * MON#1At 09:00 UTC, on the 1st Mon. Spring accepts names with #.
First runs after 1 Jan 2027 (UTC): Mon, 04 Jan 2027, 09:00 ยท Mon, 01 Feb 2027, 09:00 ยท Mon, 01 Mar 2027, 09:00
0 9 ? * 6#3 *At 09:00 UTC, on the 3rd Fri. Third Friday of the month in EventBridge.
First runs after 1 Jan 2027 (UTC): Fri, 15 Jan 2027, 09:00 ยท Fri, 19 Feb 2027, 09:00 ยท Fri, 19 Mar 2027, 09:00
Common mistakes
- Setting #5 and expecting it every month. Some months have only four of a given weekday, so the job skips those months.
- Mixing up the weekday numbering. Quartz starts at Sunday = 1.
Frequently asked questions
How do I schedule the second Tuesday in plain cron?
Use "0 9 8-14 * *" with a weekday check in the script, because standard cron ORs the day fields.