I tried Quartz.com documentation & googled for couple for hours…but could not find single good article on how to get Next Job (which is supposr to fire in future).
I am using CronTrigger Expression to Schedule jobs, using VB.net (winforms). jobs works fine…however I would like my users to see when will it FIRE next. I am storing CronExpression in my database, Can I use that Expression to show next Fire Date/Time to my end users? or if there is any other way possible please advise (with a simple samply).
Thanks
Edit
Following Code Returns next job will fire after 12 minutes instead of 20 minute
Dim exp As CronExpression = New CronExpression("0 0/20 * * * ?")
Dim nextFire As String = exp.GetNextValidTimeAfter(DateTime.Now)
MsgBox(nextFire)
You can create a new JobKey
and use the key to fetch the job detail:
this is a simple function which does what you’re looking for:
It works only if you have one trigger per job.
If there’s more than one trigger in your job you can loop through them:
or using Linq (
System.Linq) :