Software represents time in two compact ways: Unix timestamps record an exact instant as a single number, and cron expressions schedule recurring jobs with five short fields. Both are universal across Linux servers, databases, APIs, GitHub Actions, Kubernetes, and Cloudflare Workers — and both are notorious for subtle production bugs around seconds versus milliseconds, time zones, daylight saving transitions, and overlapping executions. This guide covers the rules, worked examples, and failure modes to check before shipping.
Unix timestamps: one universal number for every instant
A Unix timestamp (also called POSIX or epoch time) counts the seconds elapsed since 1 January 1970, 00:00:00 UTC, excluding leap seconds. The number 1798502400 represents the exact same moment in New Delhi, Tokyo, London, and New York; only the formatted wall-clock text changes by time zone.
Counting digits: seconds, milliseconds, microseconds, nanoseconds
| Unit | Typical digits (2026) | Example | Where you see it |
|---|---|---|---|
| Seconds | 10 digits | 1770000000 | Unix/Linux, SQL, JWT (exp/iat), Stripe, Python time.time() |
| Milliseconds | 13 digits | 1770000000000 | JavaScript Date.now(), Java, Kafka, JSON APIs |
| Microseconds | 16 digits | 1770000000000000 | PostgreSQL internals, Parquet, browser Performance API |
| Nanoseconds | 19 digits | 1770000000000000000 | Go time.UnixNano(), Prometheus, OpenTelemetry traces |
Passing seconds to JavaScript’s new Date(1770000000) produces 21 January 1970 because JS expects milliseconds. Passing milliseconds to a system expecting seconds lands in the year 58,000. SnipFerry’s Unix Timestamp Converter auto-detects all four units, handles negative pre-1970 timestamps, parses human-readable dates and relative shorthands (now-2h, +3d, yesterday), and displays UTC, local time, ISO 8601, ISO week, and day of year side by side.
The Year 2038 problem and storage rules
Older C programs and 32-bit SQL TIMESTAMP / INT columns store epoch seconds as a signed 32-bit integer, whose maximum value is 2,147,483,647 — 19 January 2038 at 03:14:07 UTC. One second later it wraps negative to December 1901. Always use 64-bit integers (BIGINT) or timezone-aware TIMESTAMPTZ columns for new schemas.
Follow three golden rules for application dates:
- Store instants in UTC (epoch integer or ISO 8601 with
Z, e.g.2026-10-29T08:30:00Z) and convert to the user’s zone only at display time. - Store IANA time zone names, never numeric offsets. India Standard Time stays UTC+05:30 year-round, but
America/New_Yorkswitches between UTC−05:00 and UTC−04:00 for daylight saving. Storing-05:00breaks half the year. - Store calendar dates without a time zone. Birthdays, invoice dates, and public holidays are plain dates (
2026-08-15). Converting them through UTC shifts a midnight IST date backwards to2026-08-14.
Cron expressions: five fields that control schedules
Standard Unix crontab schedules consist of five space-separated fields (some schedulers like Quartz and Spring prepend a sixth seconds field):
┌─────────── minute (0–59)
│ ┌───────── hour (0–23)
│ │ ┌─────── day of month (1–31, or L for last day)
│ │ │ ┌───── month (1–12 or JAN–DEC)
│ │ │ │ ┌─── day of week (0–6, Sunday = 0 or 7, or SUN–SAT)
* * * * *
| Expression | Plain English meaning | Common use |
|---|---|---|
*/5 * * * * | Every 5 minutes (:00, :05, :10…) | Health checks, queue polling |
0 * * * * | At minute 0 of every hour | Hourly metrics roll-up |
0 9 * * 1-5 | 09:00 Monday through Friday | Weekday business digest |
*/15 9-17 * * MON-FRI | Every 15 minutes during 09:00–17:59 on weekdays | Office-hours sync |
30 2 1 * * | 02:30 on the 1st of every month | Monthly billing & invoices |
0 0 L * * | Midnight on the last day of every month | Month-end close (handles 28/29/30/31) |
0 0 * * 0 | Midnight every Sunday | Weekly database vacuum / backup |
@daily / @weekly | Macros equivalent to 0 0 * * * / 0 0 * * 0 | Readable crontab shortcuts |
Test any expression in SnipFerry’s Cron Expression Parser to read its plain-English description and inspect the next 10 scheduled execution times in both local time and UTC before committing it to production.
Six production cron pitfalls (and how to prevent them)
- UTC vs local time-zone mismatch. GitHub Actions, Cloudflare Cron Triggers, and most Kubernetes clusters evaluate cron in UTC by default. A report meant for 09:00 IST (UTC+05:30) written as
0 9 * * *runs at 14:30 IST instead; in UTC it should be30 3 * * *. - Day-of-month AND day-of-week is actually OR. In standard Vixie cron, specifying both day-of-month and day-of-week runs when either matches — so
0 9 13 * FRIfires on every 13th of the month and every Friday, not just Friday the 13th. - Daylight saving time (DST) skips and duplicates. In zones with DST, a job scheduled at 02:30 simply does not run on the spring-forward night and may run twice on the fall-back night. Schedule critical daily jobs in UTC or outside the 01:00–03:00 window.
- Overlapping runs. If a 5-minute cron job slows down and takes 8 minutes under load, a second instance launches on top of the first, creating duplicate emails or lock contention. Guard every cron job with an advisory lock or idempotency key.
- 31st-of-month schedules skip five months a year.
0 0 31 * *never runs in February, April, June, September, or November. UseLif your scheduler supports it, or run on the 1st of the following month for the previous month’s window. - Silent failures. Cron rarely alerts on non-zero exit codes by default. Send structured logs and trigger a dead-man’s-switch monitor if a critical job fails to check in on schedule.
Inspecting exp and iat epoch claims inside auth tokens? See JWT Explained, or aggregate date columns inside spreadsheets with How to Query CSV Files with SQL.