0

I have a requirement where I need to schedule a batch job 4 times in a day, at 1 AM EST, 10 AM EST, 3 PM EST, and 8 PM EST. I have scheduled this using a cron expression in Developer Console.

I have prepared the script below, please advise if is this correct.

className c = new className();
String sch = '0 0 1,10,15,20 * * *';
system.schedule('Four times in day ', sch, c);

1 Answer 1

2

No, your string is not correct. You cannot use * in both the fourth and sixth positions. Instead, you would need to use a ?, such as:

0 0 1,10,15,20 * * ?

Also, please note that your string is only correct if your user account is in EST. If you are in a different time zone, you must calculate what the hours would be in your time zone.

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.