# Cron Expression Parser and Next Run Times (`plainpipe/cron-expression-tool`) Actor

Validate cron expressions and get a plain-English meaning, parsed fields and next run times in UTC and your time zone. Use when you need to check a schedule.

- **URL**: https://apify.com/plainpipe/cron-expression-tool.md
- **Developed by:** [Plain Pipe](https://apify.com/plainpipe) (community)
- **Categories:** Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Cron Expression Parser and Next Run Times

Validate cron expressions and get a plain-English meaning, the parsed fields, the next run times in UTC and your time zone, and the previous run.

### What it does

Paste one or more cron expressions and this Actor checks each one, explains it in plain English ("At 09:00, Monday through Friday"), splits it into its fields and lists the upcoming run times both in UTC and in the IANA time zone you choose. Expressions that do not parse still get a row with `valid: false` and the reason, so you can audit a whole crontab or a list of job schedules in one run.

Supported syntax:

- 5 fields: `minute hour day-of-month month day-of-week`, for example `*/15 * * * *`.
- 6 fields with seconds first, for example `*/10 * * * * *` or Quartz-style `0 30 8 ? * MON-FRI`.
- Ranges, lists, steps, month and weekday names, `L` (last day), `W` (nearest weekday) and `#` (nth weekday, `5#2` = second Friday).
- `?` in the day fields is accepted and treated like `*`.
- Macros: `@yearly`, `@annually`, `@monthly`, `@weekly`, `@daily`, `@midnight`, `@hourly`, plus `@weekdays`, `@weekends`, `@minutely`, `@secondly`.
- Extra spaces between fields are ignored.

### Use cases

- Audit every schedule in a crontab, CI config or Kubernetes CronJob list and find the invalid ones in one run.
- Confirm a job fires at the right local time around a daylight saving change (set **Start from** to the change date).
- Turn cryptic expressions into plain-English descriptions for runbooks and documentation.
- Check that Apify schedules or other job schedules in different time zones do not overlap.

### How to use it

1. Enter your expressions in **Cron expressions**, one per line.
2. Pick a **Time zone** (IANA name, default `UTC`).
3. Optional: set **Number of next runs** and a **Start from** moment.
4. Run the Actor.
5. Export the dataset as JSON, CSV or Excel, or read it through the Apify API.

### Input

| Field | What it does | Default | Example |
| --- | --- | --- | --- |
| `expressions` (required) | List of cron expressions, one per line | none | `["*/15 * * * *", "0 9 * * 1-5", "@daily"]` |
| `timezone` | IANA time zone the schedule is evaluated in; an unknown zone fails the run | `UTC` | `Europe/Berlin` |
| `nextRunsCount` | How many upcoming runs to list per valid expression, 1 to 100 | `10` | `24` |
| `fromDate` | ISO 8601 moment to compute next and previous runs from | now | `2026-03-08T00:00:00Z` |
| `maxItems` | Stop after this many expressions | `100` | `1000` |

### Output

One row per expression. For `0 9 * * 1-5` in `Europe/Berlin` with 3 runs from `2026-11-03T00:00:00Z`:

```json
{
  "expression": "0 9 * * 1-5",
  "valid": true,
  "error": null,
  "description": "At 09:00, Monday through Friday",
  "timezone": "Europe/Berlin",
  "normalized": "0 0 9 * * 1-5",
  "hasSeconds": false,
  "fields": { "minute": "0", "hour": "9", "dayOfMonth": "*", "month": "*", "dayOfWeek": "1-5" },
  "nextRuns": [
    { "utc": "2026-11-03T08:00:00.000Z", "local": "2026-11-03T09:00:00+01:00" },
    { "utc": "2026-11-04T08:00:00.000Z", "local": "2026-11-04T09:00:00+01:00" },
    { "utc": "2026-11-05T08:00:00.000Z", "local": "2026-11-05T09:00:00+01:00" }
  ],
  "previousRun": { "utc": "2026-11-02T08:00:00.000Z", "local": "2026-11-02T09:00:00+01:00" },
  "intervalMinutes": null
}
```

| Field | Meaning |
| --- | --- |
| `valid`, `error` | Whether the expression parses, and the reason when it does not |
| `description` | Plain-English summary of the schedule |
| `normalized` | The expression as 6 fields (seconds first), names turned into numbers and macros expanded |
| `fields` | The 5 standard fields; `second` is added when the expression has a seconds field |
| `nextRuns`, `previousRun` | Run times in UTC and in the chosen time zone |
| `intervalMinutes` | Set only when runs are evenly spaced (15 for `*/15 * * * *`); `null` for uneven gaps such as weekdays only |

An invalid expression gives a status row with `valid: false`, an `error` message such as `Expected 5 fields ... got 4`, and empty run fields. These rows are part of the audit result.

### Pricing

Pay per result: **$0.50 per 1,000 results** ($0.0005 per result). You only pay for results the Actor returns. Set a maximum total charge on the run to cap your spend.

### Limits

- 7-field Quartz expressions (with a year field) are reported as unsupported; drop the year to check the rest.
- `@reboot` has no schedule, so it is reported as not valid.
- Jenkins-style `H` and non-standard extensions of other schedulers may be read differently than your scheduler reads them.
- The English description is generated by a library and is a summary; the listed run times are the authoritative answer.
- At most 100 next runs per expression. `intervalMinutes` looks at the first 12 runs only.
- An empty expression list, an unknown time zone or an unreadable start date fail the run with no results.

### FAQ

**How much does it cost to check a crontab?**
One result per expression: 200 expressions cost $0.10. The number of next runs you list does not change the price.

**Are invalid expressions charged?**
Yes, each expression gives one row, valid or not, because the `valid: false` row with its reason is the answer you asked for. A run with an unknown time zone or bad start date fails before any row and costs nothing.

**How are daylight saving changes handled?**
Run times are computed in the IANA zone you choose, so a `0 2 * * *` job in `Europe/London` shows `+01:00` before the October change and `+00:00` after it. Set **Start from** to just before the change to see it.

**Can I compare runs with holidays?**
Yes. Get public holiday dates with the Plain Pipe Actor **ICS Calendar Parser and iCal to JSON** and check them against the `nextRuns` list.

**Can I run it on a schedule or from my own code?**
Yes. Start runs through the Apify API, webhooks or integrations such as Make and Zapier, for example from a CI step that checks schedule changes before a deploy.

### Legal and data

This Actor processes only what you give it or public, non-personal technical data. It does not log in anywhere, does not collect personal data, and does not bypass paywalls, CAPTCHAs or access controls. You are responsible for having the right to process the inputs you provide.

### Support

Open an issue on the Issues tab. Issues are answered within 14 days.

**Use this when:** you need to validate a cron expression, explain it in plain English or see exactly when it will run next in a given time zone.

### Why this one

- $0.50 per 1,000 results: one result per expression.
- Each row includes the normalized 6-field form, the parsed fields, next runs in both UTC and your IANA time zone, the previous run and an even-interval value in minutes.
- Accepts 5- and 6-field expressions, @daily-style macros and Quartz-style `?`; pure computation with no browser, proxy or network access, and the prefill run finishes in a few seconds.
- The prefilled input is test-run daily.

Built and maintained by Plain Pipe.

# Actor input Schema

## `expressions` (type: `array`):

One cron expression per line, e.g. \*/15 \* \* \* \* or 0 9 \* \* 1-5. Accepts 5 fields (minute hour day-of-month month day-of-week), 6 fields with seconds first, macros such as @daily or @hourly, and Quartz-style ? in the day fields. Each expression becomes one result row, valid or not.

## `timezone` (type: `string`):

IANA time zone the schedule runs in (default UTC), e.g. Europe/Berlin, America/New_York or Asia/Kolkata. Run times are listed in UTC and in this zone.

## `nextRunsCount` (type: `integer`):

How many upcoming run times to list for each valid expression, 1 to 100 (default 10, e.g. 24 to see a full day of an hourly job).

## `fromDate` (type: `string`):

Compute next and previous runs relative to this moment instead of now. ISO 8601 date-time, e.g. 2026-03-08T00:00:00Z to check a daylight saving change. Leave empty (default) to use the current time.

## `maxItems` (type: `integer`):

Stop after this many expressions (default 100, e.g. 1000 for a large crontab). You are charged per result.

## Actor input object example

```json
{
  "expressions": [
    "*/15 * * * *",
    "0 9 * * 1-5",
    "@daily"
  ],
  "timezone": "UTC",
  "nextRunsCount": 5,
  "maxItems": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "expressions": [
        "*/15 * * * *",
        "0 9 * * 1-5",
        "@daily"
    ],
    "timezone": "UTC",
    "nextRunsCount": 5,
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("plainpipe/cron-expression-tool").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "expressions": [
        "*/15 * * * *",
        "0 9 * * 1-5",
        "@daily",
    ],
    "timezone": "UTC",
    "nextRunsCount": 5,
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("plainpipe/cron-expression-tool").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "expressions": [
    "*/15 * * * *",
    "0 9 * * 1-5",
    "@daily"
  ],
  "timezone": "UTC",
  "nextRunsCount": 5,
  "maxItems": 10
}' |
apify call plainpipe/cron-expression-tool --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,plainpipe/cron-expression-tool"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/AnKwAWWHFK0rcNzWp/builds/59Ry68bBaNAILzucd/openapi.json
