-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcron-parser.html
More file actions
195 lines (175 loc) · 12.2 KB
/
cron-parser.html
File metadata and controls
195 lines (175 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cron Expression Parser — Human-Readable Schedule Description</title>
<meta name="description" content="Parse and generate cron expressions with a human-readable description and next run times. Free online cron expression parser and builder.">
<link rel="canonical" href="https://www.quicktools.mom/cron-parser.html">
<meta property="og:title" content="">
<meta property="og:description" content="">
<meta property="og:type" content="website">
<meta property="og:url" content="https://www.quicktools.mom/cron-parser.html">
<meta name="twitter:card" content="summary">
<link rel="stylesheet" href="style.css">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-2658921743607446" crossorigin="anonymous"></script>
<script type="application/ld+json">{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"📚 Common Cron Presets
🧠 Cron Cheat Sheet
* any value
, value list separator (1,3,5)
- range of values (1-5)
/ step values (*/15 = every 15)
0-59 minute
0-23 hour
1-31 day of month
1-12 month
0-6 day of week (0 = Sunday)
Ad Space — 336×280
<div class="tool-card" style="max-width:720px;">
<h2 style="font-size:1rem;margin-bottom:0.75rem;">📖 About Cron Expression Parser</h2>
<p style="font-size:0.85rem;line-height:1.7;color:var(--text-muted);margin-bottom:0.75rem;">Cron Expression Parser is a free, browser-based tool built for developers, designers, and everyday users. Parse and generate cron expressions with a human-readable description and next run times. Free online cron expression parser and builder. This tool processes everything locally using JavaScript — no data is uploaded to any server, no account is required, and there are no usage limits. Whether you’re working on a quick project or handling sensitive data, your privacy is fully protected. Bookmark this page and use it anytime — it works on desktop, tablet, and mobile devices.</p>
<h3 style="font-size:0.9rem;margin-bottom:0.5rem;">How to Use</h3>
<ol style="font-size:0.85rem;color:var(--text-muted);line-height:1.7;padding-left:1.2rem;">
<li><strong>Enter your data</strong> — Type, paste, or upload your input in the fields above.</li>
<li><strong>Configure options</strong> — Adjust any settings or parameters to match your requirements.</li>
<li><strong>Get instant results</strong> — Output updates automatically in real-time as you type.</li>
<li><strong>Copy or download</strong> — Use the Copy button to grab results, or download if available.</li>
</ol>
</div>
Frequently Asked Questions
What is a cron expression?","acceptedAnswer":{"@type":"Answer","text":"A cron expression is a string of five fields representing a schedule: minute, hour, day of month, month, and day of week. It's used in Unix/Linux systems, CI/CD pipelines, and cloud services to schedule recurring tasks."}},{"@type":"Question","name":"What does */5 mean?","acceptedAnswer":{"@type":"Answer","text":"The /5 means 'every 5th.' So */5 in the minute field means 'every 5 minutes.' In the hour field, */2 would mean 'every 2 hours.'"}}]}</script>
</head>
<body>
<div class="page-wrapper">
<header class="site-header"><a href="index.html" class="site-logo"><span class="icon">⚡</span> QuickTools</a><nav class="site-nav"><a href="index.html">All Tools</a></nav></header>
<div class="ad-zone ad-zone-top">Ad Space — 728×90</div>
<div class="tool-header">
<div class="tool-badge">⏰ Developer</div>
<h1>Cron Expression Parser</h1>
<p>Parse cron expressions into human-readable descriptions with next scheduled run times.</p>
</div>
<div class="tool-card">
<label>Cron Expression</label>
<input type="text" id="cronInput" class="mono" value="*/15 9-17 * * 1-5" oninput="parseCron()" style="font-size: 1.2rem; text-align: center; letter-spacing: 0.1em;">
<div style="display: flex; justify-content: space-around; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.5rem;">
<span>Minute</span><span>Hour</span><span>Day</span><span>Month</span><span>Weekday</span>
</div>
<div id="description" style="text-align: center; padding: 1.5rem; font-size: 1.1rem; color: var(--accent-hover); margin-top: 1rem; background: var(--accent-glow); border-radius: var(--radius-sm);"></div>
<div id="nextRuns" class="mt-3"></div>
</div>
<div class="tool-card">
<h3 style="font-size: 0.95rem; margin-bottom: 1rem;">📚 Common Cron Presets</h3>
<div style="display: flex; flex-wrap: wrap; gap: 0.5rem;" id="presets"></div>
</div>
<div class="tool-card">
<h3 style="font-size: 0.95rem; margin-bottom: 1rem;">🧠 Cron Cheat Sheet</h3>
<div style="font-family: monospace; font-size: 0.82rem; line-height: 2; color: var(--text-secondary);">
<div><span class="text-muted" style="display: inline-block; width: 60px;">*</span> any value</div>
<div><span class="text-muted" style="display: inline-block; width: 60px;">,</span> value list separator (1,3,5)</div>
<div><span class="text-muted" style="display: inline-block; width: 60px;">-</span> range of values (1-5)</div>
<div><span class="text-muted" style="display: inline-block; width: 60px;">/</span> step values (*/15 = every 15)</div>
<div style="margin-top: 0.5rem;"><span class="text-muted" style="display: inline-block; width: 60px;">0-59</span> minute</div>
<div><span class="text-muted" style="display: inline-block; width: 60px;">0-23</span> hour</div>
<div><span class="text-muted" style="display: inline-block; width: 60px;">1-31</span> day of month</div>
<div><span class="text-muted" style="display: inline-block; width: 60px;">1-12</span> month</div>
<div><span class="text-muted" style="display: inline-block; width: 60px;">0-6</span> day of week (0 = Sunday)</div>
</div>
</div>
<div class="ad-zone">Ad Space — 336×280</div>
<div class="faq-section">
<h2>Frequently Asked Questions</h2>
<div class="faq-item"><h3>What is a cron expression?</h3><p>A cron expression is a string of five fields representing a schedule: minute, hour, day of month, month, and day of week. It's used in Unix/Linux systems, CI/CD pipelines, and cloud services to schedule recurring tasks.</p></div>
<div class="faq-item"><h3>What does */5 mean?</h3><p>The /5 means "every 5th." So */5 in the minute field means "every 5 minutes." In the hour field, */2 would mean "every 2 hours."</p></div>
</div>
<div class="related-tools"><h2>Related Tools</h2><div class="related-grid">
<a href="timestamp-converter.html"><span class="tool-icon">🕐</span> Timestamp Converter</a>
<a href="json-formatter.html"><span class="tool-icon">{ }</span> JSON Formatter</a>
<a href="regex-tester.html"><span class="tool-icon">⚙️</span> Regex Tester</a>
<a href="uuid-generator.html"><span class="tool-icon">🆔</span> UUID Generator</a>
</div></div>
<div class="ad-zone ad-zone-bottom">Ad Space — 728×90</div>
<footer class="site-footer"><p>© 2026 QuickTools.</p><div class="footer-links"><a href="index.html">All Tools</a><a href="#">Privacy</a></div></footer>
</div>
<script>
const presets = [
['Every minute', '* * * * *'], ['Every 5 min', '*/5 * * * *'], ['Every 15 min', '*/15 * * * *'],
['Every hour', '0 * * * *'], ['Every 6 hours', '0 */6 * * *'], ['Daily midnight', '0 0 * * *'],
['Daily at 9 AM', '0 9 * * *'], ['Weekdays 9 AM', '0 9 * * 1-5'], ['Mon-Fri 9-5 hourly', '0 9-17 * * 1-5'],
['Weekly Sunday', '0 0 * * 0'], ['Monthly 1st', '0 0 1 * *'], ['Yearly Jan 1', '0 0 1 1 *'],
];
document.getElementById('presets').innerHTML = presets.map(([label, expr]) =>
`<button class="btn btn-secondary" style="font-size: 0.78rem;" onclick="document.getElementById('cronInput').value='${expr}'; parseCron();">${label}<br><span class="text-muted" style="font-size: 0.7rem;">${expr}</span></button>`
).join('');
const dayNames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
const monthNames = ['','January','February','March','April','May','June','July','August','September','October','November','December'];
function describePart(part, type) {
if (part === '*') return `every ${type}`;
if (part.includes('/')) { const [base, step] = part.split('/'); return `every ${step} ${type}s` + (base !== '*' ? ` starting at ${base}` : ''); }
if (part.includes('-')) { const [a,b] = part.split('-'); return type === 'weekday' ? `${dayNames[a]} through ${dayNames[b]}` : `${a} through ${b}`; }
if (part.includes(',')) return part.split(',').map(v => type === 'weekday' ? dayNames[v] : v).join(', ');
return type === 'weekday' ? dayNames[part] : part;
}
function parseCron() {
const input = document.getElementById('cronInput').value.trim();
const parts = input.split(/\s+/);
if (parts.length !== 5) { document.getElementById('description').textContent = 'Invalid cron expression (need 5 fields)'; return; }
const [min, hour, dom, month, dow] = parts;
let desc = 'Runs ';
if (min === '*' && hour === '*') desc += 'every minute';
else if (min.includes('/')) desc += describePart(min, 'minute');
else if (min === '0' && hour === '*') desc += 'every hour at minute 0';
else if (min === '0' && hour.includes('/')) desc += describePart(hour, 'hour');
else if (hour !== '*') desc += `at ${hour.padStart(2,'0')}:${min.padStart(2,'0')}`;
else desc += `at minute ${min}`;
if (dom !== '*') desc += `, on day ${dom} of the month`;
if (month !== '*') desc += `, in ${describePart(month, 'month')}`;
if (dow !== '*') desc += `, on ${describePart(dow, 'weekday')}`;
document.getElementById('description').textContent = desc;
// Calculate next runs
const runs = getNextRuns(parts, 10);
document.getElementById('nextRuns').innerHTML = '<h3 style="font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.5rem;">Next 10 Runs</h3>' +
runs.map((d,i) => `<div style="padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; display: flex; justify-content: space-between;">
<span class="text-muted">#${i+1}</span>
<span class="text-mono">${d.toLocaleString()}</span>
<span class="text-muted">${getRelative(d)}</span>
</div>`).join('');
}
function matchesCron(date, parts) {
const [min,hour,dom,month,dow] = parts;
return fieldMatches(date.getMinutes(), min) && fieldMatches(date.getHours(), hour) &&
fieldMatches(date.getDate(), dom) && fieldMatches(date.getMonth()+1, month) &&
fieldMatches(date.getDay(), dow);
}
function fieldMatches(value, field) {
if (field === '*') return true;
return field.split(',').some(part => {
if (part.includes('/')) { const [base, step] = part.split('/'); const b = base === '*' ? 0 : parseInt(base); return (value - b) % parseInt(step) === 0 && value >= b; }
if (part.includes('-')) { const [a,b] = part.split('-').map(Number); return value >= a && value <= b; }
return value === parseInt(part);
});
}
function getNextRuns(parts, count) {
const runs = [];
const d = new Date();
d.setSeconds(0, 0);
d.setMinutes(d.getMinutes() + 1);
let safety = 0;
while (runs.length < count && safety < 525600) {
if (matchesCron(d, parts)) runs.push(new Date(d));
d.setMinutes(d.getMinutes() + 1);
safety++;
}
return runs;
}
function getRelative(d) {
const diff = (d - new Date()) / 1000;
if (diff < 60) return 'in ' + Math.round(diff) + 's';
if (diff < 3600) return 'in ' + Math.round(diff/60) + 'min';
if (diff < 86400) return 'in ' + Math.round(diff/3600) + 'h';
return 'in ' + Math.round(diff/86400) + 'd';
}
parseCron();
</script>
<script src="ads.js"></script>
</body>
</html>