当前位置:网站首页>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 耗尽主机内存一例分析
- The IPO of Ruineng industry was terminated: the annual revenue was 447million and it was planned to raise 376million
- [buuctf.reverse] 152-154
- R語言ggplot2可視化:可視化折線圖、使用theme函數中的legend.position參數自定義圖例的比特置
- 金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
- C语言中限定符的作用
- Sqllab 1-6 exercise
- Shen Ziyu, nouveau Président de Meizu: M. Huang Zhang, fondateur de Meizu, agira comme conseiller stratégique pour les produits scientifiques et technologiques de Meizu
- UE source code reading [1]--- starting with problems delayed rendering in UE
- Laravel - model (new model and use model)
猜你喜欢

SAS接口有什么优势特点
![[machine learning notes] several methods of splitting data into training sets and test sets](/img/f6/eca239bb4b1764a1495ccd9a868ec1.jpg)
[machine learning notes] several methods of splitting data into training sets and test sets

Simple process of penetration test

-Web direction attack and defense world

TiCDC 6.0原理之Sorter演进

Xampp configuring multiple items

Redis如何实现多可用区?

Deep copy is hard

Detailed explanation of IP address and preparation of DOS basic commands and batch processing

Postman简介、安装、入门使用方法详细攻略!
随机推荐
用“新”字来吸引好奇的人群
登录界面代码
Brief introduction to revolutionary neural networks
软件测试人在深圳有哪些值得去的互联网公司【软件测试人员专供版】
Detailed explanation of IP address and preparation of DOS basic commands and batch processing
tidb-dm报警DM_sync_process_exists_with_error排查
神经网络物联网未来发展趋势怎么样
R language uses boxplot function in native package (basic import package, graphics) to visualize box plot
What are the advantages and characteristics of SAS interface
Discussion on memset assignment
Request + BS4 crawl Netease cloud music popular comments
鸿蒙第四次培训
openGauss数据库源码解析系列文章—— 密态等值查询技术详解(下)
Laravel dompdf exports PDF, and the problem of Chinese garbled code is solved
C语言中限定符的作用
2022 construction welder (special type of construction work) special operation certificate examination question bank and online simulation examination
R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses the coef function to obtain the log odds ratio corresponding to eac
Shenziyu, the new chairman of Meizu: Mr. Huang Zhang, the founder, will serve as the strategic adviser of Meizu's scientific and technological products
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
一网打尽异步神器CompletableFuture