Timestamps and scheduling guides

Cron day and weekday: why both restrictions may use OR

Explain a schedule that runs on the first day or on Mondays and avoid mistaking it for an intersection.

Nav Tools ·

Read the two date fields together

For the five-field behavior used here, restricted day-of-month and day-of-week fields use OR. Matching either restriction can select a date.

The example requests midnight on the first day of the month or on a Monday. It does not mean only months whose first day is Monday.

0 0 1 * 1
Day: first of month OR Monday

Use a counterexample

Preview from a date whose month starts midweek. A Monday that is not the first makes OR behavior immediately visible.

For July 2024, July 8 is a Monday and should appear under this expression. July 8 is not the first of the month.

Intersection needs another mechanism

If the requirement is the first day only when it is Monday, a standard OR-based expression does not express that intersection directly.

Schedule a narrower candidate run and check the calendar in the job, or use a scheduler feature whose intersection semantics are documented.

Confirm the actual scheduler

Cron libraries and hosted services may implement different dialects or offer strict modes. Nav Tools previews cron-parser under its five-field policy.

Keep a fixed-date preview fixture with the expression. Test the same fixture in the production scheduler before relying on the calendar rule.

References

← Timestamps and scheduling guides