Is there any java class to get Date from cron expression

后端 未结 5 1653
时光说笑
时光说笑 2021-01-04 05:46

I need to find out the first occurrence of Date and time represented by given cron expression. Is there any java class, utility code which can help in getting data object fr

5条回答
  •  盖世英雄少女心
    2021-01-04 06:33

    You can also leverage on spring's http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/scheduling/support/CronSequenceGenerator.html for this

    CronSequenceGenerator generator = new CronSequenceGenerator(cronExpression);
    Date nextRunDate= generator.next(new Date());
    

提交回复
热议问题