Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Interval/Cron expression translation

Charles-Antoine Clément
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 13, 2021

With ScriptRunner it seems that there is a library that makes a "human readable" translation for a Interval/Cron expression.

2021-08-13 10_43_05-Window.png

Like this example, ScriptRunner translate 0 0 6 1 3 ? to At 6:00 AM on day 1 of the month, only in March

How can I access this function with the ScritRunner console ? My goal is to write a Groovy script that will send this information in an email.

So far I managed to translate the expression into the next date of execution with the CronSequenceGenerator function but I would like to get the detailled explanation.

 

import org.springframework.scheduling.support.CronSequenceGenerator;
CronSequenceGenerator generator = new CronSequenceGenerator(retJob.cron);
Date nextRunDate= generator.next(new Date());
retJob.nexExcutionDate = nextRunDate.format("yyyy.MM.dd 'at' hh:mm:ss z")


Thanks !

0 answers

Suggest an answer

Log in or Sign up to answer