Cron Expression Parser
Parse cron expressions into plain English and preview next 5 execution times.
minute · hour · day-of-month · month · day-of-week
| Field | Value | Range | Meaning |
|---|---|---|---|
| Minute | 0 | 0–59 | 0 |
| Hour | 9 | 0–23 | 9 |
| Day (month) | * | 1–31 | every day |
| Month | * | 1–12 | every month |
| Day (week) | 1-5 | 0–6 | 1-5 (range) |
ทำความเข้าใจ cron syntax
อ้างอิงฟิลด์
รูปแบบที่พบบ่อย
Cron เป็นแกนหลักของการทำงานอัตโนมัติตามกำหนดเวลาบนระบบ Unix cron expression ให้คุณระบุกำหนดการได้ละเอียดเท่า "ทุกวันทำงานเวลา 8:05 น." หรือกว้างเท่า "ปีละครั้งในวันที่ 1 มกราคม" เมื่อเข้าใจโครงสร้างห้าฟิลด์แล้ว คุณสามารถแสดงกำหนดการซ้ำๆ เกือบทุกรูปแบบได้
นักพัฒนาวาง cron job ที่รับมาจาก codebase เก่าที่นี่เพื่อเข้าใจว่าจริงๆ แล้วทำงานตามกำหนดเวลาไหนก่อนแก้ไข SRE ใช้การดูตัวอย่างครั้งถัดไปเพื่อตรวจสอบว่า maintenance window job จะไม่ทำงานในช่วง traffic สูงสุด วิศวกรที่ debug งานกำหนดเวลาที่พลาดใช้ parser เพื่อยืนยันว่า expression ถูกต้องตาม syntax และเวลาทำงานถัดไปตรงกับที่คาดหวัง ทีมที่ review ไฟล์ GitHub Actions workflow วาง schedule trigger เพื่อแปลเป็นภาษาธรรมดาสำหรับผู้มีส่วนได้ส่วนเสียที่ไม่ใช่ด้านเทคนิค
- นาที: 0–59 — ใช้ */5 สำหรับทุก 5 นาที
- ชั่วโมง: 0–23 — ใช้ 9-17 สำหรับชั่วโมงทำงาน
- วันในเดือน: 1–31 — ใช้ 1,15 สำหรับสองครั้งต่อเดือน
- เดือน: 1–12 หรือ JAN–DEC — ใช้ */3 สำหรับรายไตรมาส
- วันในสัปดาห์: 0–6 (อาทิตย์=0) หรือ SUN–SAT — ใช้ 1-5 สำหรับวันทำงาน
- * * * * * — ทุกนาที
- 0 * * * * — ต้นของทุกชั่วโมง
- 0 0 * * * — ทุกวันตอนเที่ยงคืน
- 0 0 * * 0 — ทุกวันอาทิตย์ตอนเที่ยงคืน
- 0 0 1 * * — วันแรกของทุกเดือนตอนเที่ยงคืน
- 0 0 1 1 * — ปีละครั้งในวันที่ 1 มกราคม
- */15 * * * * — ทุก 15 นาที
- 0 9-17 * * 1-5 — ทุกชั่วโมงในช่วงเวลาทำงานของวันทำงาน
คำถามที่พบบ่อย
- What is a cron expression?
- A cron expression is a string of five (or six) fields separated by spaces that defines a recurring schedule for automated tasks. It is used in Unix-like systems, CI/CD pipelines, cloud schedulers (AWS EventBridge, GCP Cloud Scheduler), and application frameworks to trigger jobs at specific times.
- What are the five fields in a cron expression?
- The five fields are, in order: Minute (0–59), Hour (0–23), Day of Month (1–31), Month (1–12 or JAN–DEC), and Day of Week (0–6 or SUN–SAT, where 0 = Sunday). Example: '0 9 * * 1-5' means 9:00 AM every weekday.
- What does */15 mean in a cron expression?
- The */n syntax means 'every n units'. So */15 in the minute field means 'every 15 minutes' (i.e., at :00, :15, :30, :45). Similarly, */2 in the hour field means 'every 2 hours'.
- Can I use commas and ranges together?
- Yes. You can combine lists (1,3,5), ranges (1-5), and steps (*/2 or 1-10/2) in a single field using commas. For example, '0,30 9-17 * * 1-5' means every 30 minutes from 9 AM to 5 PM on weekdays.
- Why do some cron expressions have 6 or 7 fields?
- The standard Unix cron uses 5 fields. Some systems add a seconds field at the start (making it 6 fields), or a year field at the end (making it 7 fields). This parser handles the standard 5-field format used by most Linux crons, GitHub Actions schedules, and cloud schedulers.
เครื่องมือที่เกี่ยวข้อง
- JSON Formatter, Validator & Repair Tool
Format, minify, validate, and repair JSON instantly in your browser. Sort keys alphabetically, auto-format on paste, download as file, escape/unescape strings — free, no sign-up, 100% client-side.
- ตัวสร้าง QR Code
สร้าง QR code สำหรับ URL ข้อความ Wi-Fi และอื่นๆ ดาวน์โหลดเป็น PNG
- ตัวสร้างรหัสผ่าน
สร้างรหัสผ่านสุ่มที่แข็งแกร่งด้วยความยาวและชุดอักขระที่กำหนดเอง
- Base64 เข้ารหัส / ถอดรหัส
เข้ารหัสข้อความเป็น Base64 หรือถอดรหัสกลับเป็นข้อความธรรมดา
- URL เข้ารหัส / ถอดรหัส
เข้ารหัสหรือถอดรหัส URL และ query strings ด้วย percent-encoding