时间范围的Cron表达式 [英] Cron expression for a time range

查看:1112
本文介绍了时间范围的Cron表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Quartz.Net在我的应用程序中安排我的工作。我只是想知道是否可以构建下面场景的CRON表达式:

I am using Quartz.Net to schedule my jobs in my application. I was just wondering if a CRON expression for the following scenario can be built:


上午2:15和上午5:20之间每秒钟


Every second between 2:15AM and 5:20AM


推荐答案

robyaw,

很多为你的答案。对于回复的延迟,我深表歉意。我实际上已经下了一段时间。你的解决方案确实有效。我不得不为我指定的时间范围创建3 CRON触发器。你是对的,你提到的时间范围。但是,对于您提到的3个CRON表达式。我恐怕他们可能不会按预期工作。这些表达式适用于时间范围:2:15 AM - 5:20 AM - 每天

Thanks a lot for your answer. And I apologize for such a delay in replying. I had actually been off for a while. Your solution indeed works. I had to create 3 CRON triggers for the time range that I had specified. You were right with the time ranges that you had mentioned. However, for the 3 CRON expressions that you had mentioned. I am afraid they might not work as intended. These expressions work for the time range : 2:15AM - 5:20AM - Everyday

1) * 15-59 2 * *? code> - 每天从上午2:15到凌晨3:00,即2:15:00 AM到2:59:59 AM

1) * 15-59 2 * * ? - Every second from 2:15AM to 3:00AM, ie, 2:15:00AM to 2:59:59AM

2) * 0-59 3-4 * *? - 每天凌晨3:00至凌晨5:00,即凌晨3:00:00至凌晨4:59:59

2) * 0-59 3-4 * * ? - Every second from 3:00AM to 5:00AM, ie, 3:00:00AM to 4:59:59AM

3) * 0-19 5 * *? - 每5:00 AM至5:20 AM :00AM to 5:19:59 AM

3) * 0-19 5 * * ? - Every second from 5:00AM to 5:20AM, ie, 5:00:00AM to 5:19:59AM

@gauteh:请注意Quartz .Net实际上支持第二次触发。

@gauteh : Please note that Quartz .Net actually supports secondly trigger.

希望这有助于其他需要解决类似问题的人。

Hope this helps others who might need a solution to a similar problem.

这篇关于时间范围的Cron表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆