A
A
Anton2011-09-09 13:31:49
Java
Anton, 2011-09-09 13:31:49

Quartz cron expression - set start and end times?

Good day ... I
need the ability in Java to run tasks that would be scheduled at a certain interval, I tried the quartz library for this, using Cron Expressions, but they are not suitable for all cases ... For example, you need to run a task every day from 18.20 to 22.50 every 5 minutes…
Please advise either a library that could do this, or some methods that can be used to create Cron Expression for such cases… Thanks in advance…

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
Zamorozka, 2011-09-09
@Zamorozka

In the job itself, check that 18:20 <= new Date() <= 22:50
After that, create a task with an interval: 0 0/5 18,19,20,21,22 * *?
This means to run every 5 minutes. from [18 to 23) hours.

A
Anton, 2011-09-12
@kosmonaFFFt

Thank you, the idea is interesting ... Apparently, you will have to make a wrapper for the task and use SimpleTrigger in it ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question