Cron expression with start and end time

后端 未结 4 1896
南笙
南笙 2021-01-19 00:15

I am trying to write an cron expression with a specific start time and end time everyday. i.e. every minute from 10:15 to 17:35 everyday

One possible solution for t

4条回答
  •  礼貌的吻别
    2021-01-19 00:55

    Quartz Scheduler c# run job between to hours

    use corn mask:

            ITrigger trigger_1 = TriggerBuilder.Create()
                .ForJob("YOUR_JOB")
                .WithIdentity("trigger_1")
                .StartAt(startTime)
                .WithCronSchedule("0 0/1 8-13 ? *   SUN,MON,TUE,WED,SAT *")
                .Build();
    

    use Quartz Schedule:

    trigger_1 = TriggerBuilder
                .Create()
                .ForJob("YOUR_JOB")
                .WithIdentity("trigger_1")
                .StartAt(startTime)
                .WithDailyTimeIntervalSchedule(c => c
                    .OnEveryDay()
                    .WithIntervalInMinutes(1).WithRepeatCount(1)
                    .StartingDailyAt(new TimeOfDay(08, 30))
                    .EndingDailyAt(new TimeOfDay(12, 30))
                )
                .Build();
    

提交回复
热议问题