UTC Best Practices

Use UTC for reliable, predictable cron job scheduling.

Best Practice: Schedule all production cron jobs in UTC to avoid timezone and DST complications.

Why UTC?

✅ No DST Changes

UTC never observes Daylight Saving Time

✅ Server Mobility

Move servers between datacenters without schedule changes

✅ Global Consistency

Same schedule works worldwide

Setting UTC in Cron

Method 1: TZ Variable

# Add to top of crontab TZ=UTC # Your jobs now run in UTC 0 14 * * * /path/to/script.sh # 2 PM UTC daily

Method 2: Per-Job

# Set timezone per job 0 14 * * * TZ=UTC /path/to/script.sh

Method 3: System UTC

# Set entire system to UTC sudo timedatectl set-timezone UTC

Time Conversion

Common Conversions

US Eastern Time

EST: UTC - 5 hours
EDT: UTC - 4 hours

US Pacific Time

PST: UTC - 8 hours
PDT: UTC - 7 hours

Central Europe

CET: UTC + 1 hour
CEST: UTC + 2 hours

Asia/Tokyo

JST: UTC + 9 hours
(No DST)

Real-World Examples

Daily Backup (9 PM EST/EDT)

# BAD: Changes with DST
0 21 * * * /backup.sh
# GOOD: Always UTC
TZ=UTC
0 2 * * * /backup.sh # 9 PM EST = 2 AM UTC

Business Hours Monitoring

TZ=UTC
# Monitor during US business hours (9 AM - 5 PM EST)
*/15 14-22 * * 1-5 /monitor.sh # 9 AM - 5 PM EST in UTC

Documentation Tips

📝 Always Document

# Daily backup at 2 AM UTC (9 PM EST/8 PM EDT) TZ=UTC 0 2 * * * /opt/scripts/backup.sh