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

# Cron Expressions

> Learn how to use cron expressions to schedule tasks

<Note>
  You can edit cron jobs visually using our [Cron Editor](https://rapidcron.com/cron-editor).
</Note>

Cron expressions are used to define schedules for recurring tasks. They consist of five fields that represent minute,
hour, day of the month, month, and day of the week. Each field can contain a single value, a range of values, a list of
values, or a step value.

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

## Special Characters

You can use several special characters in cron expressions to create flexible scheduling patterns:

* `*` (asterisk): Matches any value
* `,` (comma): Separates individual values
* `-` (hyphen): Defines a range of values
* `/` (forward slash): Specifies step values
* `?` (question mark): No specific value (only for Day of Month and Day of Week)

## Common Examples

Here are some frequently used cron expressions:

* `* * * * *`: Every minute
* `0 * * * *`: Every hour (at minute 0)
* `0 0 * * *`: Every day at midnight
* `0 0 * * 0`: Every Sunday at midnight
* `0 0 1 * *`: First day of every month at midnight
* `*/15 * * * *`: Every 15 minutes
* `0 9-17 * * 1-5`: Every hour from 9 AM to 5 PM, Monday through Friday

## Field Values

### Minutes (0-59)

* Valid values: 0-59
* Example: `15` (at minute 15)
* Example: `*/5` (every 5 minutes)

### Hours (0-23)

* Valid values: 0-23
* Example: `9` (at 9:00 AM)
* Example: `9-17` (between 9:00 AM and 5:00 PM)

### Day of Month (1-31)

* Valid values: 1-31
* Example: `1` (first day of the month)
* Example: `1,15` (1st and 15th of the month)
* Note: Use `?` when specifying Day of Week

### Month (1-12)

* Valid values: 1-12
* Example: `3` (March)
* Example: `3,6,9,12` (quarterly)

### Day of Week (0-7)

* Valid values: 0-7 (both 0 and 7 represent Sunday)
* Example: `1` (Monday)
* Example: `1-5` (Monday through Friday)
* Note: Use `?` when specifying Day of Month

## Advanced Patterns

### Step Values

Use `/` to specify step values within ranges:

* `*/15 * * * *`: Every 15 minutes
* `0 */2 * * *`: Every 2 hours
* `0 0 */2 * *`: Every 2 days

### Multiple Values

Use `,` to specify multiple values:

* `0 0 1,15 * *`: At midnight on 1st and 15th of every month
* `0 9 * * MON,WED,FRI`: At 9 AM on Monday, Wednesday, and Friday

### Ranges

Use `-` to specify ranges:

* `0 9-17 * * *`: Every hour from 9 AM to 5 PM
* `0 0 * * 1-5`: At midnight, Monday through Friday

## Common Use Cases

### Business Hours

* `0 9-17 * * 1-5`: Every hour during business hours (9 AM - 5 PM, Monday-Friday)
* `*/30 9-16 * * 1-5`: Every 30 minutes during core business hours

### Daily Maintenance

* `0 0 * * *`: Daily at midnight
* `0 2 * * *`: Daily at 2 AM (common for backups)

### Weekly Reports

* `0 9 * * MON`: Every Monday at 9 AM
* `0 0 * * SUN`: Every Sunday at midnight

### Monthly Tasks

* `0 0 1 * *`: First day of every month at midnight
* `0 12 15 * *`: 15th day of every month at noon

## Pitfalls

**Consider timezones**: Rapidcron uses UTC for scheduling. Adjust your expressions based on your target timezone.
