Skip to main content
C
CodeUtil

Cron Generator

Build cron expressions with a visual editor and export to multiple formats.

Loading tool...

Why I Built This Cron Generator

I can never remember cron syntax. Is day-of-week 0-6 or 1-7? Does Sunday start at 0 or 1? After deploying one too many broken cron jobs, I built this visual editor so I could see exactly when my jobs would run before pushing to production.

Export Formats I Added

  • Standard Cron - The basic 5-field expression
  • Linux Crontab - Full crontab line with command placeholder
  • AWS CloudWatch - AWS has its own weird format, so I handle the conversion automatically
  • GitHub Actions - Workflow schedule YAML syntax that you can paste directly
  • Kubernetes CronJob - Complete manifest template ready to customize
  • Node.js - Code snippet using node-cron package
  • Python - APScheduler library code snippet

I often use this with the Unix Timestamp Converter to verify scheduling times and the YAML Converter when editing config files.

Cron Syntax Cheat Sheet

Here's the cron format I always forget and have to look up:

┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
│ │ │ │ │
* * * * *

Special Characters

  • * - Any value (wildcard)
  • */n - Every n units (e.g., */5 = every 5 minutes)
  • n,m - Specific values (e.g., 1,15 = 1st and 15th)
  • n-m - Range of values (e.g., 1-5 = Monday to Friday)

Expressions I Use All the Time

ExpressionWhat It Does
* * * * *Every minute (careful with this one)
0 * * * *Every hour on the hour
0 0 * * *Midnight daily
0 9 * * 1-5Weekdays at 9 AM (my favorite for notifications)
0 0 1 * *First of the month at midnight
*/15 * * * *Every 15 minutes

Platform-Specific Cron Formats

Every platform decided to do cron slightly differently. Here's what caught me off guard when deploying across AWS, GitHub Actions, and Kubernetes.

AWS EventBridge Cron

AWS uses a 6-field format that adds a year field at the end. The '?' character replaces '*' for day-of-week when you specify day-of-month (and vice versa). Took me an embarrassing amount of time to figure out why my schedules weren't firing.

# AWS EventBridge format: min hour day month day-of-week year
cron(0 12 * * ? *)       # Noon UTC daily
cron(0 9 ? * MON-FRI *)  # 9 AM weekdays
cron(0/15 * * * ? *)     # Every 15 minutes
rate(5 minutes)          # Alternative: rate expressions

GitHub Actions Schedule

GitHub Actions uses standard 5-field format but runs in UTC only — no timezone override. Minimum interval is 5 minutes, though GitHub may delay execution during high-load periods.

on:
  schedule:
    # Weekdays at 9 AM UTC
    - cron: '0 9 * * 1-5'
    # Every 6 hours
    - cron: '0 */6 * * *'
    # Sunday midnight (weekly cleanup)
    - cron: '0 0 * * 0'

Kubernetes CronJob

Kubernetes uses standard 5-field cron. Since v1.25, you can set timeZone in the spec. Before that, jobs ran in the controller's timezone, which caused surprises across clusters.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: daily-backup
spec:
  schedule: "0 2 * * *"
  timeZone: "America/New_York"  # v1.25+
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: backup
            image: backup-tool:latest
          restartPolicy: OnFailure

Google Cloud Scheduler

Google Cloud Scheduler supports standard cron with explicit timezone configuration. Unlike GitHub Actions, you can pick any IANA timezone.

gcloud scheduler jobs create http daily-report \
  --schedule="0 9 * * 1-5" \
  --time-zone="Europe/Prague" \
  --uri="https://api.example.com/report"

Related Articles

Frequently Asked Questions

What's the difference between standard cron and AWS cron?

AWS cron drives me crazy. They use a 6-field format with an extra year field, and you have to use '?' instead of '*' in certain cases. The good news: this generator handles the conversion automatically, so you don't have to think about it.

Is my cron expression valid?

Yep, I validate expressions in real-time and show you a plain English description of what it does. If something's wrong, you'll see an error right away.

How do I test my cron schedule?

Check the "Next Scheduled Runs" section. It shows exactly when your job will execute, so you can verify the schedule before deploying. I learned to always check this after accidentally running a job every minute instead of every hour.