0

java - Spring, i want to crate cron expression to run every after 2 hours only on Wednesday till day end

0 0 0/2 * * WED *

mean cron should trigger every wednessday only for these times 2am, 4am, 6am, 8am,10am, 12pm, 2pm,4pm, 6pm, 8pm, 10pm, 12pm

i don't have time long to wait and test can some one please confirm is it correct ?

d-man
  • 57,473
  • 85
  • 212
  • 296

1 Answers1

0

Even though it is way to late i like to answer the question for other users.

Your CronExpression is invalid. You can check this here or here. The problem is: You cannot specify a day_of_month AND a day_of_week.

Cause you are setting a day_of_week you should skip day_of_month with a "?". Solution should be:
0 0 0/2 ? * WED *

Naxos84
  • 1,890
  • 1
  • 22
  • 34