# Cron patterns

## Syntax of cron pattern;

```
// ┌────────────── minute (0 - 59)
// │ ┌──────────── hour (0 - 23)
// │ │ ┌────────── day of month (1 - 31)
// │ │ │ ┌──────── month (1 - 12, JAN-DEC)
// │ │ │ │ ┌────── day of week (0 - 6, SUN-Mon) 
// │ │ │ │ │       (0 to 6 are Sunday to Saturday; 7 is Sunday, the same as 0)
// │ │ │ │ │
// * * * * *
```

## Quick examples

#### This will runs every minute

\* \* \* \* \*

This will runs every Sunday

0 0 \* \* 7

#### Every 30 minutes from 9 a.m. to 5 p.m.

\*/30 9-17 \* \* \*

#### From Monday to Friday at 11:30

30 11 \* \* 1-5

#### Every 10 minutes

\*/10 \* \* \* \*

#### At midnight

00 00 \* \* \*

## It is also possible to use the following "nicknames" as pattern.

| Nickname  | Description                            |
| --------- | -------------------------------------- |
| @yearly   | Run once a year, ie. "0 0 1 1 \*".     |
| @annually | Run once a year, ie. "0 0 1 1 \*".     |
| @monthly  | Run once a month, ie. "0 0 1 \* \*".   |
| @weekly   | Run once a week, ie. "0 0 \* \* 0".    |
| @daily    | Run once a day, ie. "0 0 \* \* \*".    |
| @hourly   | Run once an hour, ie. "0 \* \* \* \*". |

### [A convenient website for generating cron patterns](https://www.freeformatter.com/cron-expression-generator-quartz.html)[ #1](https://www.freeformatter.com/cron-expression-generator-quartz.html)

### [A convenient website for generating cron patterns #2](https://crontab.cronhub.io/)

### [A convenient website for generating cron patterns #3](https://crontab.guru/)

### [A convenient website for generating cron patterns #4](https://hexagon.github.io/cron-builder/)

{% hint style="info" %}
A cron pattern with an interval of less than 60 seconds cannot be created!
{% endhint %}

{% hint style="info" %}
All patterns are executed in the UTC time zone
{% endhint %}
