---
id: "cron_expression"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["software", "datetime"]
langs: ["common"]
quality: 85
url: "https://registry.apicrafter.io/datatype/cron_expression"
---

# Cron schedule expression (`cron_expression`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Schedule of a cron job: five fields separated by spaces, giving the minute, the hour, the day of the month, the month and the day of the week (0 is Sunday). POSIX allows an asterisk for all values, a number, a range a-b or a comma-separated list in each field; the regexp also accepts the step suffix /n that most cron implementations support. It does not check the value ranges, month and weekday names or @ shortcuts.

- Personal data (PII): no
- Categories: Software development (software), Date and time (datetime)
- Countries: global
- Languages: Common to most languages (common)

## Detection

Regular expression (Python `re`):

```
^(?:\*|[0-9]+(?:-[0-9]+)?(?:,[0-9]+(?:-[0-9]+)?)*)(?:/[0-9]+)?(?:\s+(?:\*|[0-9]+(?:-[0-9]+)?(?:,[0-9]+(?:-[0-9]+)?)*)(?:/[0-9]+)?){4}$
```

## Examples

- `15 3 * * 1-5` — Example from the POSIX crontab specification
- `0 0 1,15 * 1` — Example from the POSIX crontab specification
- `15 3 * *` (invalid example) — Four fields

## Supported by tools

- `pydantic`
- `pywhat`

## Sources

- doc: <https://pubs.opengroup.org/onlinepubs/9799919799/utilities/crontab.html>

## Quality

Score 85/100. Missing: mapping (Wikidata, Schema.org, ...), translation.

JSON: <https://registry.apicrafter.io/api/v1/datatypes/cron_expression.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/software/cron_expression.yaml>
