'How to convert LIST of dates to single CronExpression?
Since I applied for internship I have to resolve this task: I need to create a method that turns list of dates to single CronExpression. Only Java code (no outside frameworks). Just like this :
Input:
"2022-01-25 T 08:00:00"
"2022-01-25 T 08:30:00"
"2022-01-25 T 09:00:00"
"2022-01-25 T 09:30:00"
"2022-01-26 T 08:00:00"
"2022-01-26 T 08:30:00"
"2022-01-26 T 09:00:00"
"2022-01-26 T 09:30:00"
Output:
"0 0/30 8-9 * * *"
I have 2 questions:
Is there any general (commonly used) way to do that? Or it is not typical task and I have to create that method from the zero?
Can you explain me a logic of how I need to do that? Mainly I don't understand how to convert SEVERAL dates to one CronExpression.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
