Cron expression for a time range

后端 未结 3 1613
忘了有多久
忘了有多久 2020-12-11 08:19

I am using Quartz.Net to schedule my jobs in my application. I was just wondering if a CRON expression for the following scenario can be built:

Every

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 08:22

    You have here a interval trigger (every second) that translates cleanly to SimpleTrigger. What you need with it is a restriction to only allow it to run in specific time range (2:15 - 5:20). This you can achieve by using a calendar, more precisely a DailyCalendar. You can set daily calendar to have this time range and set the InvertTimeRange to true to include the range instead of default of excluding the range.

    Read more about the calendars in the tutorial and DailyCalendar API documentation.

提交回复
热议问题