当前位置:网站首页>Time to calculate cron expression based on cronsequencegenerator
Time to calculate cron expression based on cronsequencegenerator
2022-07-05 14:12:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm your friend, Quan Jun .
Spring Provides CronSequenceGenerator Class for calculation cron The specific time point of the expression next Method (Spring3.2 edition ) and cron Is it legal isValidExpression Method (Spring4.3 edition ).
Practical examples :
package construct;
import org.springframework.scheduling.support.CronSequenceGenerator;
import java.util.Date;
/**
* Created by zhangzh on 2017/1/18.
*/
public class CronSequenceGeneratorTest {
public static void main(String[] args) {
String cron = "0 */5 * * * ?"; // Every five minutes
CronSequenceGenerator cronSequenceGenerator = new CronSequenceGenerator(cron);
Date currentTime = new Date();
System.out.println("currentTime: " + currentTime);
Date nextTimePoint = cronSequenceGenerator.next(currentTime); // currentTime To calculate the start time of the next time point
System.out.println("nextTimePoint: " + nextTimePoint);
Date nextNextTimePoint = cronSequenceGenerator.next(nextTimePoint);
System.out.println("nextNextTimePoint: " + nextNextTimePoint);
}
}Output results :
currentTime: Wed Jan 18 19:45:25 CST 2017
nextTimePoint: Wed Jan 18 19:50:00 CST 2017
nextNextTimePoint: Wed Jan 18 19:55:00 CST 2017see , Easy !
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/149579.html Link to the original text :https://javaforall.cn
边栏推荐
- MySQL user-defined function ID number to age (supports 15 / 18 digit ID card)
- OSI and tcp/ip protocol cluster
- poi设置列的数据格式(有效)
- 2022 construction welder (special type of construction work) special operation certificate examination question bank and online simulation examination
- 关于Apache Mesos的一些想法
- R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用coef函数获取模型中每个变量(自变量改变一个单位)对应的对数优势比(log odds ratio)
- TiFlash 面向编译器的自动向量化加速
- Tiflash compiler oriented automatic vectorization acceleration
- 循环不变式
- Liste des liens (simple)
猜你喜欢

Comparison of several distributed databases

upload (1-6)

神经网络物联网未来现状和趋势及看法

Lepton 无损压缩原理及性能分析

清大科越冲刺科创板:年营收2亿 拟募资7.5亿

昆仑太科冲刺科创板:年营收1.3亿拟募资5亿 电科太极持股40%

魅族新任董事長沈子瑜:創始人黃章先生將作為魅族科技產品戰略顧問

Guofu hydrogen energy rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, and 360million yuan of accounts receivable exceed the revenue

Anchor navigation demo

Tiflash compiler oriented automatic vectorization acceleration
随机推荐
物联网应用技术专业是属于什么类
国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收
R language ggplot2 visualization: gganimate package is based on Transition_ The time function creates dynamic scatter animation (GIF) and uses shadow_ Mark function adds static scatter diagram as anim
TiFlash 面向编译器的自动向量化加速
R language uses the polR function of mass package to build an ordered multi classification logistic regression model, and uses the coef function to obtain the log odds ratio corresponding to each vari
Recommendation number | what are interesting people looking at?
R language ggplot2 visualization: visual line graph, using legend in theme function The position parameter defines the position of the legend
TDengine 社区问题双周精选 | 第三期
OSI and tcp/ip protocol cluster
LeetCode_69(x 的平方根 )
登录界面代码
矩阵链乘 - 动态规划实例
Hongmeng fourth training
R语言ggplot2可视化密度图:按照分组可视化密度图、自定义配置geom_density函数中的alpha参数设置图像透明度(防止多条密度曲线互相遮挡)
Why do I support bat to dismantle "AI research institute"
Deep copy is hard
为什么我认识的机械工程师都抱怨工资低?
常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...
C语言中限定符的作用
poi设置列的数据格式(有效)