当前位置:网站首页>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 2017
see , 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
边栏推荐
- Login interface code
- 区间 - 左闭右开
- 2022 machine fitter (Advanced) test question simulation test question bank simulation test platform operation
- R语言dplyr包select函数、group_by函数、mutate函数、cumsum函数计算dataframe分组数据中指定数值变量的累加值、并生成累加数据列
- R语言ggplot2可视化密度图:按照分组可视化密度图、自定义配置geom_density函数中的alpha参数设置图像透明度(防止多条密度曲线互相遮挡)
- R language uses boxplot function in native package (basic import package, graphics) to visualize box plot
- 总量分析 核算方法和势方法 - 分摊分析
- Tdengine biweekly selection of community issues | phase III
- 牛客网:拦截导弹
- Use the word "new" to attract curious people
猜你喜欢
为什么我认识的机械工程师都抱怨工资低?
魅族新任董事长沈子瑜:创始人黄章先生将作为魅族科技产品战略顾问
神经网络物联网未来发展趋势怎么样
Tiflash compiler oriented automatic vectorization acceleration
Mingfeng medical sprint technology innovation board: annual revenue of 350million yuan, proposed to raise 624million yuan
Scenario based technology architecture process based on tidb - Theory
金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
软件测试人在深圳有哪些值得去的互联网公司【软件测试人员专供版】
Oneconnect listed in Hong Kong: with a market value of HK $6.3 billion, ye Wangchun said that he was honest and trustworthy, and long-term success
UE source code reading [1]--- starting with problems delayed rendering in UE
随机推荐
故障分析 | MySQL 耗尽主机内存一例分析
3W原则[通俗易懂]
What is the future development trend of neural network Internet of things
清大科越冲刺科创板:年营收2亿 拟募资7.5亿
The IPO of Ruineng industry was terminated: the annual revenue was 447million and it was planned to raise 376million
LeetCode_3(无重复字符的最长子串)
Leetcode array question brushing notes
Request + BS4 crawl Netease cloud music popular comments
JS takes key and value from an array object to form a new object
[js] basic syntax - for loop
矩阵链乘 - 动态规划实例
-Web direction attack and defense world
Sqllab 1-6 exercise
一网打尽异步神器CompletableFuture
Interpretation of tiflash source code (IV) | design and implementation analysis of tiflash DDL module
openGauss数据库源码解析系列文章—— 密态等值查询技术详解(下)
upload (1-6)
Detailed explanation of SSH password free login
最简单不用证书也可以多开功能的方式
R language dplyr package select function, group_ By function, mutate function and cumsum function calculate the cumulative value of the specified numerical variable in the dataframe grouping data and