cronjobsquartz.net

What is the difference between */10 and 0/10 in Quartz Scheduler


We're using Quartz jobs on the project.

I don't understand the subtle difference between these two Cron expressions used in Quartz:

*/10 * * * * ?

and

0/10 * * * * ?

Does the former mean "Trigger your job every 10 seconds from now on"?

Whereas the latter means "Trigger the job every 10 seconds starting at xx:yy:00 in the next minute"?

So, for example, if the current time is 16:32:47, the job shall get triggered at:

etc.?


Solution

  • */10 * * * * ? means every tenth second - e.g., 16:00:00, 16:00:10, 16:00:20, etc.

    0/10 * * * * ? means every tenth second, starting with 0, which is as you alluded to, not very useful, and it's arguably easier to use the previous syntax.

    The usecase for this syntax is for non-zero arguments, e.g.:
    2/10 * * * * ? means every tenth second, starting with 2, so you'd get 16:00:02, 16:00:12, etc.