Orlixio

8 min read

Cron expressions explained

Cron expressions compactly describe recurring schedules, but fields, timezones, and platform differences matter.

Table of contents

  1. The five fields
  2. Common operators
  3. Timezone and runtime
  4. Safer scheduling

The five fields

A basic cron expression has five fields: minute, hour, day of month, month, and day of week. The expression 0 9 * * 1 means minute 0, hour 9, every day of month, every month, on Monday.

The compact format is efficient for machines but not always obvious for humans. Reading field by field is the safest way to understand a schedule.

Common operators

An asterisk means every allowed value. A comma lists specific values. A hyphen describes a range. A slash describes a step, such as every five minutes. These operators can often be combined, depending on the scheduler.

Platform differences matter. Some systems support month or weekday names, while others expect only numbers. Some add a seconds field at the beginning.

Timezone and runtime

A cron expression does not always include timezone information. The scheduler decides which timezone applies. In cloud systems, that may be UTC unless configured otherwise.

Daylight saving time can also affect local schedules. If a job must run at an exact universal instant, UTC schedules are usually easier to reason about.

Safer scheduling

Keep schedules simple and document them in plain language next to the expression. For production jobs, include timezone, owner, expected runtime, and what happens if a run fails or overlaps.

Before saving a schedule, use a helper to catch obvious field mistakes, then confirm the exact syntax in your platform's documentation.

Related guides

FAQ

What are the five cron fields?

Minute, hour, day of month, month, and day of week.

Does every cron system support the same syntax?

No. Some schedulers add seconds, years, names, or special operators.

What does */5 mean?

It usually means every five units for that field.

Why is timezone important?

A schedule runs according to the timezone configured by the scheduler, which may not be your local timezone.