I have many services that run on a daily basis all based on cron values passed to them. I'm working on a service that needs to know the number of times per day each service does its job. Is it possible to convert a cron expression into a 'number per day/week' in Java 1.8 specifically? Just fyi, I'm in a spring boot project for this, in case that somehow makes any difference.
For example, assume I have an expression like 0 1 0-20/4 * * *
. That job would run 5 times every day. I had something in mind like:
float dailyUploads = someLibrary.cronToFloat("0 1 0-20/4 * * *");
where dailyUploads == 5.0
When I google this, most results only deal with creating cron expressions. I did find one interesting post about converting cron to date-time values.
It occurs to me that I could use a cron sequence generator (mentioned in the above-linked answer) to sequence until the day changes followed by counting the results, but that only gives me the results for that one day; what about a service that runs once every year? I just can't find a clean way to do this.
Thank you for any assistance.