当前位置:网站首页>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
边栏推荐
- Xampp configuring multiple items
- R language uses boxplot function in native package (basic import package, graphics) to visualize box plot
- 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
- R语言ggplot2可视化条形图:通过双色渐变配色颜色主题可视化条形图、为每个条形添加标签文本(geom_text函数)
- 不相交集
- TiCDC 6.0原理之Sorter演进
- Geom of R language using ggplot2 package_ Histogram function visual histogram (histogram plot)
- The simplest way to open more functions without certificates
- Interpretation of tiflash source code (IV) | design and implementation analysis of tiflash DDL module
- Implementation process of WSDL and soap calls under PHP5
猜你喜欢

牛客网:拦截导弹

What is the future development trend of neural network Internet of things
![UE source code reading [1]--- starting with problems delayed rendering in UE](/img/fa/f33242b01e4da973fa36c2c6f23db6.png)
UE source code reading [1]--- starting with problems delayed rendering in UE

Shenziyu, the new chairman of Meizu: Mr. Huang Zhang, the founder, will serve as the strategic adviser of Meizu's scientific and technological products

Why do I support bat to dismantle "AI research institute"

-Web direction attack and defense world
![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]

TDengine 社区问题双周精选 | 第三期

金融壹賬通香港上市:市值63億港元 葉望春稱守正篤實,久久為功

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
随机推荐
Introduction, installation, introduction and detailed introduction to postman!
为什么我认识的机械工程师都抱怨工资低?
Geom of R language using ggplot2 package_ Histogram function visual histogram (histogram plot)
MySQL user-defined function ID number to age (supports 15 / 18 digit ID card)
What category does the Internet of things application technology major belong to
Anchor navigation demo
Why do mechanical engineers I know complain about low wages?
金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
基于 TiDB 场景式技术架构过程 - 理论篇
Judge whether the variable is an array
How to deeply understand the design idea of "finite state machine"?
Routing in laravel framework
What is the ranking of GF futures? Is it safe and reliable to open an account for GF futures online?
最长公共子序列 - 动态规划
广发期货排名多少?网上办理广发期货开户安全可靠吗?
强联通分量
Make the seckill Carnival more leisurely: the database behind the promotion (Part 2)
Current situation, trend and view of neural network Internet of things in the future
魅族新任董事長沈子瑜:創始人黃章先生將作為魅族科技產品戰略顧問
R语言dplyr包select函数、group_by函数、mutate函数、cumsum函数计算dataframe分组数据中指定数值变量的累加值、并生成累加数据列