Skip to main content
Hi All,

I want to run the batch from monday to friday in between 9 AM to 5 PM for every one hour. Please tell me how to proceed.

Thanks,

Sarma
2 answers
  1. Nov 30, 2018, 7:28 AM
    Hi,

    You can try something like below

    apexScheduledJob j = new apexScheduledJob ();

    String sch = '0 17 9 ? * MON-FRI *'

    System.schedule('My Job', sch, j);

    Check with below blog which has the explanation for the same.

    https://salesforce.stackexchange.com/questions/16841/apex-cron-job-command-to-schedule-an-apex-job-to-run-every-4-hours-daily/189036

    https://www.forcetalks.com/blog/using-cron-expression-in-salesforce/

     

    You can validate your expression from below link.

    http://www.cronmaker.com/

     

    Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.

                                                 

    Best Regards

    Sandhya