Skip to content

Is it possible to have job scheduled at specific time in his timezone? #468

Answered by lahma
PiotrPerak asked this question in General
Discussion options

You must be logged in to vote

Probably works with ICalendarIntervalTrigger:

        var dailyTrigger = (IOperableTrigger)TriggerBuilder.Create()
            .StartAt(new DateTime(2017, 1, 4, 15, 0, 0, DateTimeKind.Utc))
            .WithCalendarIntervalSchedule(x => x
                .WithIntervalInDays(2)
                .InTimeZone(TimeZoneUtil.FindTimeZoneById("Central Standard Time")))
            .Build();

        var fireTimes = TriggerUtils.ComputeFireTimes(dailyTrigger, null, 60);
        foreach (var time in fireTimes)
        {
            Console.WriteLine(time.ToString("s"));
        }
2017-01-04T09:00:00
2017-01-06T09:00:00
2017-01-08T09:00:00
2017-01-10T09:00:00
2017-01-12T09:00:00
2017-01-14T09:00:00
…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lahma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #468 on August 01, 2020 07:33.