Cron Expression Generator
Build cron expressions visually with presets and next execution times.
Human-readable description
Runs every day at midnight
About this tool
Cron expressions are the standard syntax for scheduling tasks in Unix-like systems, databases, and web applications. Understanding how to write them correctly can be challenging due to their terse format, which uses five or six fields to represent minute, hour, day, month, and day-of-week patterns. This tool eliminates the guesswork by providing a visual interface where you can select your desired schedule using intuitive dropdowns and radio buttons, then instantly see the corresponding cron expression and when the job will next run.
To use the tool, start by selecting your schedule frequency from common presets like "Every minute," "Hourly," "Daily at a specific time," or "Custom." Once you choose a preset or custom option, adjust the specific time or day constraints using the interactive controls. The tool immediately generates the standard cron expression syntax and displays the next execution time, making it simple to verify your schedule before deploying it to your application. This is particularly useful when configuring background jobs, database maintenance tasks, or automated reports where accuracy is critical.
Frequently Asked Questions
Code Implementation
import re
def describe_cron(expression: str) -> str:
"""Parse a cron expression and return a plain-text description."""
parts = expression.strip().split()
if len(parts) != 5:
raise ValueError("Expected 5 fields: minute hour day month weekday")
minute, hour, day, month, weekday = parts
def field(val, unit):
if val == "*": return f"every {unit}"
if val.startswith("*/"):
return f"every {val[2:]} {unit}s"
if "," in val:
return f"{unit}s {val}"
if "-" in val:
lo, hi = val.split("-")
return f"from {unit} {lo} to {hi}"
return f"at {unit} {val}"
months = ["", "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
parts_desc = [
field(minute, "minute"),
field(hour, "hour"),
field(day, "day-of-month"),
field(month, "month"),
field(weekday, "weekday"),
]
return ", ".join(parts_desc)
# Examples
print(describe_cron("0 9 * * 1-5")) # Every weekday at 9 AM
print(describe_cron("*/15 * * * *")) # Every 15 minutes
print(describe_cron("0 0 1 * *")) # First day of every month at midnightComments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.