Cron expression: on the last day of the month

0 0 28-31 * * runs on the last day of the month. Here is what each field means, when it runs next and how to use it in crontab, GitHub Actions, Kubernetes and Node.js.

Updated

0 0 28-31 * *
Cron expression
On the last day of the month
Schedule

Open in the Cron Expression Generator →

What 0 0 28-31 * * means

Cron reads five fields from left to right: minute, hour, day of the month, month and day of the week. For on the last day of the month they are:

FieldValueMeaningAllowed
Minute000–59
Hour000:000–23
Day of month28-3128 through 311–31
Month*every month1–12
Day of week*every day of the week0–6 (Sun–Sat)

Next runs

Calculated in your browser for your time zone. On a server, cron uses the server’s time zone (often UTC).

  1. Enable JavaScript to see the next run times.

Typical uses

  • Month-end closing
  • Final monthly reports

Good to know

Standard cron has no “last day” value. Run on days 28–31 and let the command exit unless tomorrow is the 1st: [ "$(date -d tomorrow +\%d)" = 01 ] && /job.sh. Quartz and some schedulers support L directly.

Use it in crontab, GitHub Actions, Kubernetes and Node.js

crontab (crontab -e):

0 0 28-31 * * /usr/local/bin/my-job.sh >> /var/log/my-job.log 2>&1

GitHub Actions (times are UTC):

on:
  schedule:
    - cron: '0 0 28-31 * *'

Kubernetes CronJob:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: my-job
spec:
  schedule: "0 0 28-31 * *"
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: my-job
              image: alpine:3
              command: ["sh", "-c", "echo running"]

Node.js (node-cron):

import cron from 'node-cron';
cron.schedule('0 0 28-31 * *', () => {
  // your job
});

Related schedules

Build your own scheduleTurn any schedule into a cron expression — or any expression into plain English — with the next run times.
Open the Cron Generator

Frequently asked questions

What is the cron expression for on the last day of the month?
0 0 28-31 * *. It runs at 0; 00:00; 28 through 31.
Which time zone does cron use?
Classic cron uses the server’s local time zone, and many servers run in UTC. GitHub Actions always uses UTC. Kubernetes CronJobs use the controller’s time zone unless you set spec.timeZone (for example Europe/Berlin).
How do I test a cron expression?
Paste it into the Cron Expression Generator to see it in plain English with the next run times, then check your job’s log after the first scheduled run.