Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get next fire time only by looking at cron expression

I am running Quartz.NET as a service and I add my jobs directly in the quartz-jobs.xml file. So in order to add and delete jobs and triggers I deal with Xml and not the normal functions. I would like to know how can we get the next fire time of a trigger just by looking at its cron expression?

like image 655
disasterkid Avatar asked Sep 05 '25 03:09

disasterkid


1 Answers

You can get the next fire time from given cron expression:

var expression = new CronExpression("0 26 13 17 10 ? 2015");
DateTimeOffset? time = expression.GetTimeAfter(DateTimeOffset.UtcNow);
like image 71
Marko Lahma Avatar answered Sep 08 '25 00:09

Marko Lahma