Curious TechieDev Toolbox
All Guides/Developer Tools8 min read

Comprehensive Guide to Unix Time & Epoch Timestamps

Understand the Unix epoch (Jan 1, 1970 UTC), millisecond vs second timestamps, time zones, leap seconds, and the Year 2038 problem.

Key Takeaways
  • Unix time measures elapsed seconds since the Unix Epoch: January 1, 1970 00:00:00 UTC.
  • It is a universal, timezone-agnostic scalar integer suitable for databases and distributed event logs.
  • JavaScript uses millisecond timestamps (13 digits), while Unix systems standardly use seconds (10 digits).
  • The Year 2038 Problem (Y2038) occurs when 32-bit signed integers overflow at 2,147,483,647 seconds on Jan 19, 2038.

Computers require an unambiguous, monotonically increasing numeric format to order chronological events across servers distributed across the globe. That foundational standard is Unix Epoch Time.

1. What is the Unix Epoch?

The Unix epoch is defined as 00:00:00 Coordinated Universal Time (UTC) on Thursday, 1 January 1970. Every second that elapses increments this integer counter by 1.

2. Seconds (10-digit) vs Milliseconds (13-digit)

Operating system kernels (Linux, POSIX) measure time in seconds (e.g. 1787610000). High-level application runtimes like JavaScript and Java measure in milliseconds (e.g. 1787610000000). Multiplying or dividing by 1,000 bridges the two representations.

3. Timezones & ISO 8601 Strings

An epoch timestamp has zero timezone bias — it represents an absolute point in the universe. Local timezone formatting (e.g. EST, GMT+5:30) is applied only at presentation time using ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ).

4. The Year 2038 (Y2038) Bug Explained

Systems that store Unix timestamps in 32-bit signed integers will overflow on 03:14:07 UTC on 19 January 2038, wrapping around to negative numbers (1901). Modern 64-bit architectures eliminate this issue, extending safe timestamp capacity for 292 billion years.