当前位置:网站首页>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
边栏推荐
- JS takes key and value from an array object to form a new object
- 2022 construction welder (special type of construction work) special operation certificate examination question bank and online simulation examination
- R language ggplot2 visual density map: Visual density map by group and custom configuration geom_ The alpha parameter in the density function sets the image transparency (to prevent multiple density c
- Brief introduction to revolutionary neural networks
- Don't be unconvinced. Mobile phone function upgrade is strong
- TiCDC 6.0原理之Sorter演进
- R语言使用nnet包的multinom函数构建无序多分类logistic回归模型、使用coef函数获取模型中每个变量(自变量改变一个单位)对应的对数优势比(log odds ratio)
- 清大科越冲刺科创板:年营收2亿 拟募资7.5亿
- 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
- -Web direction attack and defense world
猜你喜欢

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

金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
![Which Internet companies are worth going to in Shenzhen for software testers [Special Edition for software testers]](/img/c2/a5f5fe17a6bd1f6f9df828ddd224d6.png)
Which Internet companies are worth going to in Shenzhen for software testers [Special Edition for software testers]

TiCDC 6.0原理之Sorter演进

TiFlash 面向编译器的自动向量化加速

SAS接口有什么优势特点

常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...

Simple process of penetration test

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

区间 - 左闭右开
随机推荐
Sqllab 1-6 exercise
MySQL user-defined function ID number to age (supports 15 / 18 digit ID card)
R language ggplot2 visual bar graph: visualize the bar graph through the two-color gradient color theme, and add label text for each bar (geom_text function)
mysql 自定义函数 身份证号转年龄(支持15/18位身份证)
upload (1-6)
鸿蒙第四次培训
Matlab learning 2022.7.4
Some ideas about Apache mesos
R language ggplot2 visualization: visual line graph, using legend in theme function The position parameter defines the position of the legend
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
openGauss数据库源码解析系列文章—— 密态等值查询技术详解(下)
3W原则[通俗易懂]
牛客网:拦截导弹
JS takes key and value from an array object to form a new object
Blue Bridge Cup study 2022.7.5 (morning)
Sorter evolution of ticdc 6.0 principle
如何深入理解“有限状态机”的设计思想?
POI set the data format of the column (valid)
2022 driller (drilling) examination question bank and simulation examination
国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收