What is Day of Month Field?

The third field in a cron expression, specifying which calendar days (1-31) the job runs.

Definition

The day-of-month field is the third field in a cron expression, accepting values from 1 to 31. It determines on which date(s) within a month the job executes. Special consideration is needed for months with fewer than 31 days โ€” setting 31 means the job skips February, April, June, September, and November.

๐Ÿ’ก

Simple Analogy

Like circling specific dates on a wall calendar โ€” the job only runs on the circled dates.

Why It Matters

Essential for monthly tasks like billing, invoicing, payroll, and end-of-month reports. Incorrect day-of-month values cause jobs to skip months unexpectedly (day 31 skips 5 months per year) or run on wrong dates.

How to Verify

Test your expression across different months. Check February (28/29 days), months with 30 days, and months with 31 days. Use the Cron Explainer to see the next 10+ runs and verify they include the right months.

โš ๏ธ

Common Mistakes

Using 31 for a monthly job โ€” it skips February, April, June, September, November. Using both day-of-month AND day-of-week in one expression โ€” they are OR-ed (job runs if EITHER matches), not AND-ed. Forgetting leap years when scheduling February 29th.

โœ…

Best Practices

For "last day of month" scheduling, use the L modifier if supported, or schedule on day 28 as a safe default. For critical monthly jobs, schedule on the 1st which exists in every month. If you need the 15th and 30th, consider that February has neither.

Cron Expression Generator

Build your cron expression

Try it free โ†’

Frequently Asked Questions

What is Day of Month Field?

The day-of-month field is the third field in a cron expression, accepting values from 1 to 31. It determines on which date(s) within a month the job executes. Special consideration is needed for months with fewer than 31 days โ€” setting 31 means the job skips February, April, June, September, and November.

Why does Day of Month Field matter for cron jobs?

Essential for monthly tasks like billing, invoicing, payroll, and end-of-month reports. Incorrect day-of-month values cause jobs to skip months unexpectedly (day 31 skips 5 months per year) or run on wrong dates.

What are best practices for Day of Month Field?

For "last day of month" scheduling, use the L modifier if supported, or schedule on day 28 as a safe default. For critical monthly jobs, schedule on the 1st which exists in every month. If you need the 15th and 30th, consider that February has neither.

Related Terms