Issue with WithCalendarIntervalSchedule

336 views
Skip to first unread message

chispa

unread,
Jan 15, 2013, 8:00:50 PM1/15/13
to quar...@googlegroups.com
I am using the  "WithCalendarIntervalSchedule" option to create a taske that should runs on the 31st of every month. Is it possible using the WithCalendarIntervalSchedule as i am getting a strange result.


 TriggerBuilder.WithIdentity(Monthly"MonthlyGroup")
                      .WithCalendarIntervalSchedule(x => x.WithInterval(1, IntervalUnit.Month).WithMisfireHandlingInstructionDoNothing())
                      .ForJob("MyKey");

 TriggerBuilder.StartAt("31\12\2013");

It runs the first time on 31\1\2013 but runs on the 28th day of all the other months. I was expecting it to run on the 31st of every month and skip february. is this possible using the configuration above or is there a better option to achieve this.

I am using Quartz version 2.0.1.100

Marko Lahma

unread,
Jan 16, 2013, 12:25:52 AM1/16/13
to Quartz. NET
You should use cron based scheduling. If you really want a trigger
that runs only on *some* months, midnight in this sample (0, 0, 0):

ITrigger trigger = TriggerBuilder.Create().WithCronSchedule("0 0 0 31
* ?").Build();
// or alternatively
ITrigger trigger =
CronScheduleBuilder.MonthlyOnDayAndHourAndMinute(31, 0, 0).Build();

A trigger that would run on the last day of every month:

ITrigger trigger = (IOperableTrigger)
TriggerBuilder.Create().WithCronSchedule("0 0 0 L * ?").Build();


-Marko
> --
> You received this message because you are subscribed to the Google Groups
> "Quartz.NET" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/quartznet/-/VKQ-L0iX3lUJ.
> To post to this group, send email to quar...@googlegroups.com.
> To unsubscribe from this group, send email to
> quartznet+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/quartznet?hl=en.
Reply all
Reply to author
Forward
0 new messages