Java code to check if two cron expressions have overlap times

Viewed 286

I'm trying to check if two cron expressions overlap at any point:

cron1 = "0 0 10 1/1 ? "; //everyday at 10am

cron2 = "0 0 10 ? MON "; //every monday at 10am

The two expressions above overlap on Monday at 10AM. Is there some way to determine if two cron expressions overlap? You can assume the expressions are valid and passed in a string format.

I checked libraries such as Quartz and cron-utils, but these only go so far as to check if two cron expressions are equivalent or give me the next execution time.

Any help would be much appreciated!

0 Answers
Related