Kevin
Kevin

Reputation: 6292

Different types of Cron Expression

I am a little confused about the Cron expression used in the unix system and the one Java Quartz is used.

The left-most entry of standard cron expression used by Unix represents "minute". But the cron expression used by Quartz uses the left most entry to represent "second":

http://quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

I want to know how many versions of cron expression are currently being used?

What happens if I pass the standard version of cron into Quartz?

Thanks a lot

Upvotes: 6

Views: 4645

Answers (1)

Kraiss
Kraiss

Reputation: 999

I don't know how much versions of Cron expression exist but the most famous one is indeed the Unix one.

If you want to translate a Unix Cron expression to a Quartz Cron expression consider this.

Quartz format is :

(second, minute, hour, day_of_month, month, day_of_week, year)

Unix format is :

        (minute, hour, day_of_month, month, day_of_week, task)

So if you to translate a Unix cron into Quartz, you just have to add a value for the second and year.

If you want the same cron, you use 0 for second and * for year

Upvotes: 6

Related Questions