What is Hour Field?

The second field in a cron expression, specifying which hours (0-23) the job runs.

Definition

The hour field is the second field in a cron expression, accepting values from 0 to 23 in 24-hour format. It determines which hour(s) of the day the job runs. Combined with the minute field, it provides precise time-of-day scheduling. Ranges like 9-17 are commonly used for business hours.

๐Ÿ’ก

Simple Analogy

Like the hour hand on a 24-hour military clock โ€” 0 is midnight, 12 is noon, 23 is 11 PM.

Why It Matters

The hour field controls when during the day your job runs. Misconfiguring it causes jobs to run during peak traffic hours, during maintenance windows, or at the wrong time entirely. Using 24-hour format prevents AM/PM confusion.

How to Verify

Verify the hour field accounts for your timezone. A job set to hour 9 in UTC runs at different local times worldwide. CronJobPro lets you set the timezone per job, so "9" always means 9 AM in your chosen timezone.

โš ๏ธ

Common Mistakes

Using 12-hour format (writing 9 for 9 PM instead of 21). Forgetting that cron uses 24-hour format exclusively. Not accounting for timezone differences โ€” hour 0 in UTC is 7 PM EST. Setting business-hours ranges without considering weekends (use the day-of-week field too).

โœ…

Best Practices

Use ranges for business-hour jobs: 9-17 covers 9 AM to 5 PM. Combine with day-of-week for weekday-only schedules. For off-peak jobs like backups, use hours 2-5 when traffic is lowest. Always specify the timezone explicitly.

Cron Expression Generator

Build your cron expression

Try it free โ†’

Frequently Asked Questions

What is Hour Field?

The hour field is the second field in a cron expression, accepting values from 0 to 23 in 24-hour format. It determines which hour(s) of the day the job runs. Combined with the minute field, it provides precise time-of-day scheduling. Ranges like 9-17 are commonly used for business hours.

Why does Hour Field matter for cron jobs?

The hour field controls when during the day your job runs. Misconfiguring it causes jobs to run during peak traffic hours, during maintenance windows, or at the wrong time entirely. Using 24-hour format prevents AM/PM confusion.

What are best practices for Hour Field?

Use ranges for business-hour jobs: 9-17 covers 9 AM to 5 PM. Combine with day-of-week for weekday-only schedules. For off-peak jobs like backups, use hours 2-5 when traffic is lowest. Always specify the timezone explicitly.

Related Terms