function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SidharthSidharth 

CRON Expression - To Schedule batch

Hi,

What will be the cron expression to schedule a batch to run :

Every 1 Hour + Every Day + 11AM - 6PM

Thanks
Sid
kaustav goswamikaustav goswami
Can you please try something like this

0 0 11-18 * * 2014

For this year every day every month from 11 to 6 pm.

Thanks,
Kaustav
SidharthSidharth
Thansk Kaustav. If i don't want restrict to this year, than use the below ?
0 0 11-18 * * ?

kaustav goswamikaustav goswami
Hi Sidharth,

You cannot use the above string to scehdule the class. The year parameter does not support the "?" character.

In stead you can use a range like 2014-2020. Maximum allowed range value is 1970-2099.

Or you can just leave it out of the cron string. It is optional anyway.

0 0 11-18 * * 2014-2050 - something like this should work.

Thanks,
Kaustav