Search code examples
cronexpression

How to write multiple cron expression


Execute the job on Monday until Saturday from 7pm until 9am and the whole day for Sunday.

I try to input multiple expressions of cron, but it's not working. Can anyone get me the solution for this?

1. " * * 19-8 ? * MON,TUE,WED,THU,FRI,SAT "
2. " * * * ? * SUN "

Solution

  • CronMaker is a utility which helps you to build cron expressions. CronMaker uses Quartz open source scheduler. Generated expressions are based on Quartz cron format.

    This expressions defines the start of a task. It does not define its duration (it belongs to the task).

    - used to specify ranges. For example, "10-12" in the hour field means "the hours 10, 11 and 12"

    CronTrigger Tutorial