Cron Expression Syntax Guide
Write and debug cron schedule expressions for task automation, with examples for common scheduling patterns.
Hash Generator
Generate SHA-1, SHA-256, SHA-384, SHA-512 hashes from text
Cron Expression Syntax
Cron expressions define recurring schedules using five fields: minute, hour, day of month, month, and day of week. Mastering this syntax lets you schedule tasks with precision.
The Five Fields
┌───── minute (0-59)
│ ┌───── hour (0-23)
│ │ ┌───── day of month (1-31)
│ │ │ ┌───── month (1-12)
│ │ │ │ ┌───── day of week (0-7, both 0 and 7 = Sunday)
* * * * *
An asterisk means "every value." A specific number means "only at that value." Ranges (1-5), lists (1,3,5), and step values (*/5 = every 5th) provide additional precision.
Common Patterns
0 9 * * 1-5 — 9:00 AM every weekday. */15 * * * * — every 15 minutes. 0 0 1 * * — midnight on the first of every month. 30 2 * * 0 — 2:30 AM every Sunday. 0 */6 * * * — every 6 hours (midnight, 6am, noon, 6pm).
Timezone Considerations
Cron traditionally runs in the server's timezone. If your server is in UTC and you want a job at 9 AM Eastern, you need to account for the offset — and the offset changes with daylight saving time (UTC-5 in winter, UTC-4 in summer). Modern cron implementations support CRON_TZ or the TZ directive to specify the intended timezone.
Testing Expressions
Browser-based cron expression tools show the next N execution times for any expression. Enter your cron expression and verify that the scheduled times match your intent. Pay special attention to edge cases: the 31st of months that have 30 days, February 29th, and timezone transitions.
Common Mistakes
0 0 * * 7 runs on Sunday (both 0 and 7 mean Sunday in most implementations). 0 0 31 * * only fires in months with 31 days. */10 9-17 * * * fires every 10 minutes during business hours, but includes 17:00, 17:10, etc. if you meant "until 5 PM", use 9-16. Step values start from 0: */3 in the hour field means 0, 3, 6, 9... not 1, 4, 7, 10.
Связанные инструменты
Связанные форматы
Связанные руководства
JSON vs YAML vs TOML: Choosing a Configuration Format
Configuration files are the backbone of modern applications. JSON, YAML, and TOML each offer different trade-offs between readability, complexity, and tooling support that affect your development workflow.
How to Format and Validate JSON Data
Malformed JSON causes silent failures in APIs and configuration files. Learn how to format, validate, and debug JSON documents to prevent integration errors and improve readability.
Base64 Encoding: How It Works and When to Use It
Base64 converts binary data into ASCII text, making it safe for transmission through text-based systems. Learn when Base64 is the right choice and when alternatives like hex encoding or URL encoding are more appropriate.
Best Practices for Working with Unix Timestamps
Unix timestamps provide a language-agnostic way to represent points in time, but they come with pitfalls around time zones, precision, and the 2038 problem. This guide covers best practices for storing and converting timestamps.
Troubleshooting JWT Token Issues
JSON Web Tokens are widely used for authentication but can be frustrating to debug. This guide covers common JWT problems including expiration errors, signature mismatches, and payload decoding issues.