I'm using Quartz job scheduler to execute a job. I want this job being executed in Monday every two week in one month. For example, for this Month(July), I will expect this job be executed in July 4 and July 18, then how I can write the cronExpression of quartz?
For this to happen correctly, you will need to have 2 seperate cronTriggers.
0 0 12 ? 1/1 MON#1 *
This reads fire at 12pm on the 1st Monday of every month.
0 0 12 ? 1/1 MON#3 *
This reads fire at 12pm on the 3rd Monday of every month.
You could also go with something less explicit to avoid having 2 seperate cronTriggers:
0 0 12 4/14 * ?
This reads fire at 12pm every 14 days every month, starting on the 4th day of the month.
Adjusting the 12 in the expression will set the time you want the job to fire. You can also adjust the 4/14 statement to match your needs. For example, 1/15 would equal every 15 days every month, starting on the 1st day of the month.