Reputation: 13367
I need cron expression which allows to me run scheduler by the following rules:
Starts 12:00 am on Friday (pacific time)
ends 12:00 am on Saturday (pacific time)
And between these two dates it must occurs every hour
i can write something like "0 0 12/1 ? * FRI-SAT"
but ofcourse it is not correct.
How to set simple range from 12-00 FRI to 12-00 SAT?
Upvotes: 0
Views: 3853
Reputation: 9791
Try this expression
0 0 12-23,00-12 ? * FRI,SAT
and you can verify the next scheduled time here at http://www.cronmaker.com/ by entering this expression.
Upvotes: 2
Reputation: 2218
If a cron expression is not easily discernible you can always build your own trigger.
I'm thinking something like this may help:
var jobDetail;
var days = new DayOfWeek[] {DayOfWeek.Friday, DayOfWeek.Saturday};
var trigger = TriggerBuilder.Create()
.ForJob(jobDetail)
.WithDailyTimeIntervalSchedule(x => x.WithIntervalInHours(1)
.OnDaysOfTheWeek(days)
.StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(0, 0)));
Upvotes: 0
Reputation: 7941
I'm guessing that you will probably need to set up two triggers, one that starts at 12:00 pm Friday and ends at midnight and triggers every hour and one for Saturday starting at 00:00 am and ends at 12:00 pm. So something like this
0 0 12-23 ? * FRI
0 0 0-12 ? * SAT
Cron Trigger Tutorial
Edit
Also have a look at Cron Maker as it will generate the cron expression for you. and also show when it will trigger.
Upvotes: 1