Utility

Unix Timestamps: Epoch Time and Time Zone Handling

Unix timestamps are the universal language of time in computing. Learn what epoch time is, how to convert it, and the timezone pitfalls every developer hits eventually.

Published August 5, 2026

Try it yourself

Timestamp Converter — free, instant, client-side

Open Timestamp Converter

What Is a Unix Timestamp?

A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970 — the Unix epoch. This moment is the universally agreed starting point for time measurement in computing.

For example, 1700000000 represents 2023-11-14T22:13:20Z.

Unix timestamps are timezone-independent — they represent an absolute point in time. Converting that absolute point to a human-readable date and time requires knowing which timezone to display it in.

Why Seconds?

The original Unix systems from Bell Labs in the 1970s chose seconds as the unit. At the time, millisecond precision was unnecessary for the intended use cases (batch job scheduling, file modification times).

Today, most languages and frameworks also support millisecond timestamps (Date.now() in JavaScript returns milliseconds, for example). This is one of the most common sources of confusion: a 13-digit timestamp is almost certainly milliseconds; a 10-digit timestamp is seconds.

Date.now()          // 1700000000000 — milliseconds
Math.floor(Date.now() / 1000) // 1700000000 — seconds

The Year 2038 Problem

Unix timestamps stored as 32-bit signed integers have a maximum value of 2,147,483,647, which corresponds to 03:14:07 UTC on 19 January 2038. After that point, a 32-bit signed timestamp overflows to a large negative number and typically represents a date in 1901.

Most modern systems have already migrated to 64-bit signed integers, which won't overflow for approximately 292 billion years. But legacy embedded systems and some databases still use 32-bit timestamps.

Timezone Handling

This is where most timestamp bugs originate.

UTC vs. local time. A Unix timestamp is in UTC. Converting it to a local time requires a timezone offset. 2023-11-14T22:13:20Z is the UTC representation. In New York (UTC-5), the same moment is 2023-11-14T17:13:20-05:00.

DST (Daylight Saving Time). Timezone offsets are not constant — they change twice a year in most places. A fixed offset like -05:00 is not a timezone; it is an offset at a specific point in time. Always use timezone names (America/New_York) rather than fixed offsets for calculations that span DST transitions.

new Date() in JavaScript. new Date(timestamp) creates a Date object representing the correct UTC moment, but toString() displays it in the local timezone of the browser or Node.js runtime. This is a common source of confusion when debugging timestamps in development vs. production.

ISO 8601. The standard format for serialising dates and times: YYYY-MM-DDTHH:mm:ss.sssZ. The Z suffix indicates UTC. Use this format for storing dates in databases and transmitting them in APIs.

Common Operations

// Current timestamp (seconds)
const now = Math.floor(Date.now() / 1000);

// Convert timestamp to Date
const date = new Date(timestamp * 1000); // multiply by 1000 for milliseconds

// Format to ISO 8601
date.toISOString(); // "2023-11-14T22:13:20.000Z"

// Get timestamp from date string
Date.parse('2023-11-14T22:13:20Z') / 1000; // back to seconds

Try It

The Timestamp Converter on Syntaxly converts Unix timestamps (seconds or milliseconds) to human-readable dates and back, with timezone selection and ISO 8601 output.

Try it yourself

Timestamp Converter — free, instant, client-side

Open Timestamp Converter

More Utility guides

Utility

Cron Syntax Demystified: Scheduling Jobs Like a Pro

Cron is the universal scheduling language for Unix systems. Learn how to read and write cron expressions, the edge cases that trip people up, and modern alternatives.

Utility

Regular Expressions: Patterns, Pitfalls, and Best Practices

Regex is powerful and cryptic. Learn the core syntax, the most useful patterns for everyday development, and the common mistakes that cause bugs in production.

Utility

Text Metrics: Word Count, Readability, and Why They Matter

Counting words and characters is deceptively nuanced. Learn how word boundaries are defined, what readability scores measure, and when text metrics actually matter for your content.

© 2026. Syntaxly | Built for the minimalist developer.