Trigger schedule per every 45 days

Issue #203 closed
Former user created an issue

Hi, I want to trigger scheduler task per every 45 day, trigger at 9.00am. I come up with following cron expression after considering your document http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger Could you please verify this?

0 0 9 0/45 ? *

Comments (1)

  1. Łukasz Modzelewski

    Unfortunately this is not how cron expression works.

    Even in the documentation you provided (this link is not a part of our documentation) this is not possible, because for the days of the month you have range 1-31 and 45 doesn't fit there and cron expression won't skip 14 days (45 - 31 = 14) to next month. Here is quote from your documentation:

    "Format

    A cron expression is a string comprised of 6 or 7 fields separated by white space. Fields can contain any of the allowed values, along with various combinations of the allowed special characters for that field. The fields are as follows:

    Field Name Mandatory Allowed Values Allowed Special Characters

    Seconds YES 0-59 , - * /

    Minutes YES 0-59 , - * /

    Hours YES 0-23 , - * /

    Day of month YES 1-31 , - * ? / L W (see: 45 ∉ <1 , 31>)

    Month YES 1-12 or JAN-DEC , - * /

    Day of week YES 1-7 or SUN-SAT , - * ? / L #

    Year NO empty, 1970-2099 , - * /

    So cron expressions can be as simple as this: * * ? *"


    Here is link to site where you can test your cron expressions http://www.cronmaker.com/

    Please take note that you could try there to generate cron expression running every 45 days... and it would give you similar to yours expression but it is misleading because it will fall to 1st day of next month - in The Scheduler we have validation to prevent you from getting into this trap. Make sure you examine next execution dates!

    The same situation is with cron expression running every 14 days - it would end up creating task at 15.06, 29.06 and 01.07, 15.07, 29,07 etc.

    We are aware that there is great need for simple triggers like every 14 days, every 10 days etc. We have this task in backlog.

    Best regards, Łukasz

  2. Log in to comment