本文介绍了只有通过查看cron表达式才能获得下一个触发时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我运行Quartz.NET作为服务,我直接在 quartz-jobs.xml
文件中添加我的作业。所以为了添加和删除作业和触发器,我处理 Xml
,而不是正常的功能。
我想知道如何通过查看其cron表达式来获得触发器的下一个触发时间。
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?
推荐答案
您可以从给定的cron表达式获取下一个触发时间:
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);
这篇关于只有通过查看cron表达式才能获得下一个触发时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!