CronTool
Cron expression editor & debugger

robfig/cron — Go cron library guide

github.com/robfig/cron/v3 is the dominant cron library in the Go ecosystem — used by Kubernetes, Caddy, GitLab Runner and many more. The default parser is strict standard cron (5-field, no L/W); the parser is configurable via bitmask options to enable seconds, year and descriptors.
For last-day-of-month patterns in robfig/cron see the dedicated guide.

Examples

  • 018***
    Every day at 18:00
  • 0*/5***
    Every 5 hours
  • 018**1-5
    Weekdays at 18:00
  • 001**
    Once a month

Cheatsheet

FieldRequiredValues RangeWildcardsminuteYes0-59, - * / hourYes0-59, - * / day of monthYes1-31, - * / L W monthYes1-12, - * /day of weekYes0-7, - * / L

Calendar

View future cron matches in a calendar

April 2026

Showing next 1000 cron schedules

Loading...

Basic usage

package main

import (
    "log"
    "time"

    "github.com/robfig/cron/v3"
)

func main() {
    c := cron.New(cron.WithLocation(time.UTC))

    c.AddFunc("0 9 * * 1-5", func() {
        log.Println("Weekday 09:00 UTC tick")
    })

    c.AddFunc("@hourly", func() {
        log.Println("Hourly tick")
    })

    c.Start()
    select {} // block forever
}

Parser options for seconds & descriptors

parser := cron.NewParser(
    cron.SecondOptional | cron.Minute | cron.Hour |
    cron.Dom | cron.Month | cron.Dow | cron.Descriptor,
)

c := cron.New(cron.WithParser(parser))

// 6-field with seconds (every 30 seconds):
c.AddFunc("*/30 * * * * *", everyThirtySeconds)

// Standard 5-field still works:
c.AddFunc("*/5 * * * *", everyFiveMinutes)

// Descriptor:
c.AddFunc("@daily", dailyTask)

Implementing the Job interface

type ReportJob struct {
    db *sql.DB
}

func (j *ReportJob) Run() {
    rows, _ := j.db.Query(...)
    // ...
}

c.AddJob("0 9 * * 1-5", &ReportJob{db: myDB})

AddJob accepts any type implementing cron.Job (a single Run() method). Useful when the job needs dependencies — pass them via the struct fields.

robfig/cron pitfalls

  • Local timezone by default — pass cron.WithLocation(time.UTC) for UTC.
  • Wraparound for `*/N` — same as Unix cron; */7 in the hour field doesn't divide 24 evenly.
  • No `L` / `W` / `#` — use runtime checks or switch to github.com/adhocore/gronx / github.com/gorhill/cronexpr.
  • Goroutine-per-job — long-running jobs don't block other ticks. If you need single-instance semantics, gate with a mutex or use cron.SkipIfStillRunning middleware.

Frequently asked questions

What cron syntax does robfig/cron use?

By default the v3 parser accepts standard 5-field cron. Use `cron.NewParser` with `cron.SecondOptional | cron.Minute | …` to enable the seconds field. Aliases like `@hourly`, `@daily`, `@weekly`, `@monthly`, `@yearly` are supported via `cron.Descriptor`.

Does robfig/cron support L, W, # modifiers?

No. robfig/cron v3 has a strict standard parser that does not support `L`, `W`, `?`, `#`. For last-day-of-month and similar, use a runtime check inside the job — see the dedicated guide.

What are robfig/cron's @-aliases?

`@yearly` (or `@annually`), `@monthly`, `@weekly`, `@daily` (or `@midnight`), `@hourly` are equivalent to the standard cron expressions for those cadences. Enable them with `cron.Descriptor` in your parser options.

How do I set the timezone in robfig/cron?

Pass `cron.WithLocation(time.UTC)` (or another `*time.Location`) to `cron.New(...)`. By default it uses the host's local timezone, which is rarely what you want in a containerised deployment.

Ready to schedule it?

Point Crontap at any URL. Pick any cron. Done.

WordPress, Shopify, Railway, Cloud Run, Vercel, HubSpot, Ghost, your own box. If it answers HTTP, Crontap can drive it on a clock you can read, in the timezone that actually matters, and page you when something breaks.

Free forever tier ・ No credit card required

Your next schedule
GET/wp-cron.php?doing_wp_cron=1

Schedule

every 5 minutes

Next run

in 23s

Apihustle Logo

This tool is part of the Apihustle suite - a collection of tools to test, improve and get to know your API inside and out.

  • Clobbr logo

    Clobbr

    The app & CLI tool to test API endpoint speed.

    Visit
  • Crontap logo

    Crontap

    Schedule recurring API calls using cron syntax.

    Visit
  • CronTool logo

    CronTool

    Debug multiple cron expressions on a calendar.

    Visit

  • Page AI

    AI Website Generator that designs and writes clean code.

    Visit
  • Shipixen

    Generate customized boilerplates in minutes.

    Visit
  • Page UI

    Landing page UI components for React & Next.js

    Visit