-1

I want to write a cron expression to schedule a batch job at the end of each quarter i.e. 31st March,30th June,30th Sep and 31st Dec but unable to figure out how to do so. Has anyone done so ?

1

1 Answer 1

1

For example, if you want to schedule a batch job to run at 11:59 PM on the last day of every quarter, you can use the following cron expression:

0 59 23 L 3,6,9,12 ?

This means:

• 0 seconds

• 59 minutes

• 23 hours

• Last day of the month

• March, June, September, and December

• Any day of the week

• Any year

You can use the System.schedule method to schedule the job using the cron expression and the name of the schedulable class. For example:

System.schedule('Quarterly Batch Job', '0 59 23 L 3,6,9,12 ?', new QuarterlyBatchJob());

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .