Java
Java

Reputation: 363

How to convert classic cronjobs to cron expressions for quartz-scheduler

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?

Upvotes: 1

Views: 1127

Answers (1)

Alexandru Somai
Alexandru Somai

Reputation: 1405

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?

Upvotes: 2

Related Questions