Search code examples
coldfusioncoldfusion-9

Schedule a task to run monthly the second week?


I have a task that runs the 1st monthly, but I would like it to run the second Tuesday of each month.

Is there a way I can schedule this on Coldfusion admin? Or how can I make this happen?

The task is very simple it just sends a email to certain people monthly.

I have coldfusion 9.


Solution

  • You could always set it to trigger every seven days from a tuesday and place this in the top of the job

    The first date of the month that can be a second occurrence is the 8th, the last is the 14th.

    <cfif dayofweekasstring(dayofweek(now())) is "Tuesday" and day(now()) lte 14 and day(now()) gte 8>
      Abort job.
    </cfif>