> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mergent.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Understanding Cron Syntax

> Master Cron syntax with our concise guide

Cron syntax is the most common method specify recurring events. It is defined by
five fields that specify when a task should be executed.

```
| | | | |
| | | | +----- Day of the Week (0 - 7) (Sunday = 0 or 7)
| | | +---------- Month (1 - 12)
| | +--------------- Day of the Month (1 - 31)
| +-------------------- Hour (0 - 23)
+------------------------- Minute (0 - 59)
```

1. **Minute**: This is the first field. It specifies the minute of the hour that
   the command will be executed. It can be any integer from 0 to 59.
2. **Hour**: This field specifies the hour of the day that the command will be
   executed. It can be any integer from 0 to 23. It's based on a 24-hour clock.
3. **Day of the Month**: This field specifies the day of the month that the
   command will be executed. It can be any integer from 1 to 31, depending on
   the month and whether it is a leap year.
4. **Month**: This field specifies the month of the year. It can be any integer
   from 1 (January) to 12 (December).
5. **Day of the Week**: This field specifies the day of the week. Both 0 and 7
   represent Sunday, 1 stands for Monday, and so on until 6, which stands for
   Saturday.

Here are some examples:

* `0 0 * * *`: This pattern tells the system to run a task every day at
  midnight.
* `0 0 1 * *`: This pattern schedules a task for midnight of the first day of
  every month.
* `0 0 * * 0`: This pattern schedules a task for every Sunday at midnight.
* `0 0 * * 1-5`: This pattern schedules a task for every weekday at midnight.

For each field, you can also specify multiple values separated by commas,
ranges, and steps.

* **Commas**: If you want a command to run at multiple, but not all, instances
  of a time unit, you can use commas. For example, `0 0,12 * * *` runs a command
  twice daily at midnight and noon.
* **Ranges**: If you want a command to run continuously for a range of time, use
  hyphens. For example, `0 0-5 * * *` runs a command at the top of the hour for
  the first 5 hours of every day.
* **Steps**: If you want to run a command at regular intervals over a range of
  time, you can use steps, specified with a slash. For example, `*/10 * * * *`
  runs a command every 10 minutes.

These patterns can also be combined. For example, `0 0-6,18-23 * * *` runs a
command hourly during the first six hours of the day and the last six hours of
the day.
