Home/Blogs/Developer Tools Guide

What Is a Unix Timestamp? A Complete Beginner's Guide (2026)

Understand what Unix timestamps are, why they start on January 1, 1970, the difference between seconds and milliseconds timestamps, and how to convert them in JavaScript, Python, and PHP.

Need to convert a Unix timestamp right now? Use the free Unix Timestamp Converter — paste any epoch value, get the date in 20 timezones, or convert a date back to epoch. No signup required.

What Is a Unix Timestamp?

A Unix timestamp (also called epoch time or POSIX time) is a single integer representing how many seconds have elapsed since January 1, 1970, 00:00:00 UTC.

For example: 1740000000 represents a specific second in history. Add 1 to get the next second. Timestamps are timezone-independent — the same number represents the same moment everywhere on Earth.

Why Does Unix Time Start on January 1, 1970?

Unix developers in the 1960s needed a reference point that predated all modern computers. January 1, 1970 was chosen as a practical convention. By starting before most computing, all real-world timestamps are positive integers, which simplifies arithmetic and storage.

The maximum 32-bit signed timestamp (2,147,483,647) corresponds to January 19, 2038 — the famous "Year 2038 problem." Modern systems use 64-bit timestamps, which extend the range billions of years into the future.

Seconds vs Milliseconds Timestamps

Two formats exist, and confusing them is a very common bug:

Format Digits Example Used By
Seconds101740000000PHP, Python, Linux, most databases
Milliseconds131740000000000JavaScript (Date.now()), Java

How to Get the Current Unix Timestamp

// JavaScript (milliseconds — divide by 1000 for seconds)
Math.floor(Date.now() / 1000)

// Python
import time; int(time.time())

// PHP
time()

// Bash/Linux
date +%s

// SQL (MySQL)
UNIX_TIMESTAMP()

// SQL (PostgreSQL)
EXTRACT(EPOCH FROM NOW())

How to Convert a Unix Timestamp to a Date

// JavaScript
new Date(1740000000 * 1000).toISOString()
// → "2025-02-19T22:13:20.000Z"

// Python
from datetime import datetime
datetime.fromtimestamp(1740000000)
// → datetime(2025, 2, 19, 22, 13, 20)

// PHP
date('Y-m-d H:i:s', 1740000000)
// → "2025-02-19 22:13:20"

Or use the free Unix Timestamp Converter — no code required. Supports 20 timezones and auto-detects seconds vs milliseconds.

Common Use Cases

  • Storing dates in databases without timezone confusion
  • Comparing two dates by simple integer subtraction
  • API responses — most APIs return dates as Unix timestamps
  • Session expiry, JWT token expiry, cache TTL
  • Logging and analytics systems
  • Scheduling future events (cron jobs, reminders)

Related Tools

FAQs

What is a Unix timestamp?

A Unix timestamp is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC (the Unix epoch). It is timezone-independent and the standard way computers store and compare time values. For example, the timestamp 1740000000 represents a specific second in history.

Why does Unix time start on January 1, 1970?

Unix developers in the 1960s chose January 1, 1970 as a convenient reference point. This date predates most modern computing infrastructure, so nearly all real-world timestamps are positive numbers. The choice was practical, not symbolic.

What is the difference between seconds and milliseconds timestamps?

A seconds timestamp is 10 digits (e.g., 1740000000). A milliseconds timestamp is 13 digits (e.g., 1740000000000). JavaScript uses milliseconds (Date.now()), while PHP, Python, and Linux use seconds. They differ by a factor of 1000.

How do I convert a Unix timestamp to a human-readable date?

In JavaScript: new Date(timestamp * 1000).toISOString(). In Python: datetime.fromtimestamp(timestamp). In PHP: date('Y-m-d H:i:s', $timestamp). Or use the free Unix Timestamp Converter online tool — paste any timestamp and get the date in 20 timezones instantly.

Sponsored

Sponsored banner