Unexpected timer starting time

At the free Cron expression website https://www.freeformatter.com/cron-expression-generator-quartz.html, the timer in the following rule is described as: “At second :00, at minute :04, every 2 hours starting at 00am, of every day”,

rule "test"
    Time cron "0 4 */2 ? * *"

However, when I loaded the rule at 5:30 PM Friday it executed at 6:04 PM Friday and every 2 hours after that. Anybody else seen this behavior?

This appears to be firing exactly as it should, every two hours at 4 minutes past the hour.

Quartz cron tutorial

1 Like


Matches with this:

To the extent that the first description might be a bit unclear in the sense that they mean that it triggers every 2 hours with 0 AM as a basis, so it triggers at 4 minutes past: 12 AM/PM, 2 AM/PM 4 AM/PM, and so on, and not every 2 hours at 4 minutes past: 1AM/PM, 3 AM/PM, 5 AM/PM and so on.

So as @namraccr already mentions, the behaviour matches the cron statement.

Edit: by the way, I would personally use Time cron "0 4 0/2 ? * *" as I find that more intuitive to read that it starts at an even hour (or with 0 as the base)

Thanks for the replies. I was, indeed, misinterpreting the description of how it should act.