I am looking for a library for Java or Scala allowing boolean composition of time intervals, to define periods like "Monday to Friday except 23:00—23:20 UTC". Something like crontab interval definition, but with arbitrary compositions allowed. Is there anything like that?
I don't know if there is something exactly like that, but as a base you could look at JODA Time, an extensive Java Library for all kinds of Date/Time handling.
EDIT:
i just remembered that the Play! Framework uses CRON expressions. It contains a CRON expression parser that may be useful to you:
https://github.com/playframework/play/blob/master/framework/src/play/libs/Time.java
Also it got this parser from Quartz, an open source job scheduler, that may also be of interest to you: http://www.quartz-scheduler.org/
Well, it's joda-time, not joda-date, but it definitely has interval mechanisms - so you'd be down to parsing the interval formats you're interested in.
Note also that Stephen has a new project, based on JSR-310, called "threeten" - see http://threeten.sourceforge.net/.
There are Scala wrapper for Joda Time and scala-datetime, a ongoing implementation of JSR-310.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With