Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any java class to get Date from cron expression

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 from given cron expression ?

like image 410
Unicorn Avatar asked Dec 06 '10 06:12

Unicorn


People also ask

How do you read a cron expression?

A cron expression is a string consisting of six or seven subexpressions (fields) that describe individual details of the schedule. These fields, separated by white space, can contain any of the allowed values with various combinations of the allowed characters for that field.

What is cron trigger in Java?

A concrete Trigger that is used to fire a JobDetail at given moments in time, defined with Unix 'cron-like' definitions. For those unfamiliar with "cron", this means being able to create a firing schedule such as: "At 8:00am every Monday through Friday" or "At 1:30am every last Friday of the month".

What is cron expression generator?

A cron expression is a string that represents a set of times at which a task will be executed. The expression comprises six fields: second(0-59), minute(0-59), hour(0-23), day of month(1-31), month(1-12 or JAN-DEC), and day of week(0-6 or SUN-SAT).


1 Answers

You can check org.quartz.CronExpression It has a method named getNextValidTimeAfter which you can use.

like image 122
saugata Avatar answered Sep 22 '22 21:09

saugata