cron表达式解析为java date

编程入门 行业动态 更新时间:2024-10-28 20:26:25
本文介绍了cron表达式解析为java date的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述
  • 我的数据库具有 10 18 16吗?* SUN,MON,WED,FRI * cron表达式,然后如何将其转换为Java日期.
  • 如何与当前时间进行比较.
  • 还有一个是如何与cron表达式(即 10 18 16)进行比较?* SUN,MON,WED,FRI * 和 0 30 9 30 *?
  • 请解释使用石英或弹簧调度的示例代码.
  • my database having 10 18 16 ? * SUN,MON,WED,FRI * cron expression then how to convert into Java date.
  • how to comparing with present day time.
  • and one more is how to compare to cron expressions i.e. 10 18 16 ? * SUN,MON,WED,FRI * and 0 30 9 30 * ?
  • please explain the sample code using quartz or spring scheduling.
推荐答案

请使用:

import org.springframework.scheduling.support.CronSequenceGenerator; final String cronExpression = "0 45 23 * * *"; final CronSequenceGenerator generator = new CronSequenceGenerator(cronExpression); final Date nextExecutionDate = generator.next(new Date());

...然后我建议使用Joda DateTime进行日期比较.

...and then I suggest use Joda DateTime for date comparison.

更多推荐

cron表达式解析为java date

本文发布于:2023-11-24 08:36:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1624496.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表达式   cron   date   java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!