What is the valid format for cron expression in smartapp schedulers?

I am writing a smart app with nodeJs. in the update section, I want to schedule a command for a specific time. (every day 6pm)
here is my code:
const cronExpression = “0 0 18 * * ?”;
await context.api.schedules.schedule(‘lightOn’, cronExpression);

error message : “‘?’ can only be specfied for Day-of-Month or Day-of-Week.”

I tried other formats too but getting other errors:
“Support for specifying both a day-of-week AND a day-of-month parameter is not implemented”

Thank you in advance.

" The cron expression for the schedule for CRON schedules. The format matches that specified by the Quartz scheduler but should not include the seconds (1st) field. The exact second will be chosen at random but will remain consistent. The years part must be les than 2 years from now."

3 Likes

Hi, @Mahdieh_Ghorbanian
Have you checked the restriction mentioned in the API reference? Create Schedule

I have used 0/10 * * * ? to run the schedule every 10 minutes.

3 Likes

Thank you. it worked @nayelyz @orangebucket

1 Like