Is there a way to get the next execution date of a scheduled job ?

I have my Apex code :

Scheduler scheduler = new Scheduler(); // Scheduler class implements Schedulable
String expr = '0 0 13 * * ?';
String id = system.schedule('Test', expr, scheduler);

And then I would like to know, with CRON expression or in the Scheduler class, what will be the date of the next execution, in this case : tomorrow at 1PM ?


You can query CronTrigger for NextFireTime.

For example; SELECT Id, NextFireTime FROM CronTrigger

This will return a datetime type.

For more info on CronTrigger class; https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_crontrigger.htm

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.