Skip to content

Run last day of month #401

Closed Answered by jamesmh
SveinnB asked this question in Q&A
Discussion options

You must be logged in to vote

There are some options as mentioned in here #382

There's no built in method to do this, specifically. But you can use the When() method to do this on your own by checking if the next day runs into the next month:

scheduler.Schedule<Job>()
   .DailyAtHour(12)
   .When(() =>
   {
      var now = DateTime.UtcNow;
      return now.Month != now.Add(TimeSpan.FromDays(1)).Month;
   });

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SveinnB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants