Home » Java » java – How to convert classic cronjobs to cron expressions for quartz-scheduler-Exceptionshub

java – How to convert classic cronjobs to cron expressions for quartz-scheduler-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am used to cronjobs like this:

0 1 * * *

In the java library quartz-scheduler they use cron expressions.

0 0 1 1/1 * ? *

Is there a way directly from quartz-scheduler or a other possability to convert or use the old cronjobs in quartz-scheduler?

Edit: I found something for JS: https://www.npmjs.com/package/cron-to-quartz is there a way in Java?

How to&Answers:

Found some library in Java that might help you: https://github.com/jmrozanec/cron-utils. Although, I haven’t used it personally.

The JS code from the library that you’ve found doesn’t seem very complex, so the alternative would be to replicate that one in Java.

BTW, what’s your need for such a conversion, can you give us more context? Is it something automatic that needs to be performed, or is it a one-time conversion only?