If you have ever stared at a number like 1753401600 and wondered what date it represents, you are not alone. That number is a Unix timestamp — the number of seconds that have elapsed since January 1, 1970 at midnight UTC. Converting between these raw numbers and human-readable dates is one of the most common tasks in software development.

This guide walks you through what Unix time actually is, why every developer needs to understand it, and how to perform timestamp to unix time conversions across the languages and tools you already use every day.

What Is Unix Time, Exactly?

Unix time (also called POSIX time or epoch time) is a single integer that counts seconds from a fixed reference point: the Unix epoch, which is 00:00:00 UTC on January 1, 1970. That is it. No time zones, no calendar rules, no daylight saving adjustments. Just a steadily increasing counter.

Here are a few reference points to build intuition:

Unix Timestamp Human-Readable Date (UTC)
0 January 1, 1970
946684800 January 1, 2000
1609459200 January 1, 2021
1753401600 July 25, 2026

The beauty of this system is its universality. A timestamp of 1753401600 means the exact same moment whether you are in Tokyo, Berlin, or Buenos Aires. The conversion to local wall-clock time happens only when you choose to display it.

Why Convert Timestamp to Unix Time?

You might wonder why we bother with these opaque numbers instead of just using formatted date strings. There are several practical reasons.

Time Zone Ambiguity Disappears

A string like 2026-07-25 12:00:00 is meaningless without a time zone. Is that noon in London? Noon in Shanghai? Those are eight hours apart. A Unix timestamp has no such ambiguity. It is a single, absolute point in time.

Sorting and Comparison Become Trivial

Need to find all events after a certain date? With Unix timestamps, it is a simple integer comparison:

SELECT * FROM logs WHERE created_at > 1753401600;

No string parsing, no time zone conversion. The database just compares numbers.

Storage Is Compact

An integer takes 4 bytes (or 8 for 64-bit). A formatted date string like "2026-07-25T12:00:00Z" takes 20 bytes. When you are storing millions of records, that difference adds up quickly.

Every Platform Agrees on It

JavaScript, Python, Java, Go, Ruby, PHP, PostgreSQL, MySQL, Redis — they all understand Unix timestamps. It is the one time format that never requires a translation layer between systems.

How to Convert Timestamp to Unix Time

JavaScript

JavaScript's Date object works in milliseconds, not seconds. This trips up a lot of developers.

// Current Unix timestamp in seconds
const now = Math.floor(Date.now() / 1000);
console.log(now); // e.g., 1753401600

// Convert a date string to Unix timestamp
const date = new Date('2026-07-25T00:00:00Z');
const timestamp = Math.floor(date.getTime() / 1000);
console.log(timestamp); // 1753401600

// Convert Unix timestamp back to a date
const ts = 1753401600;
const converted = new Date(ts * 1000);
console.log(converted.toISOString()); // "2026-07-25T00:00:00.000Z"
console.log(converted.toLocaleString()); // Local time, depends on your system

The key thing to remember: Date.now() gives you milliseconds. Divide by 1000 and floor it to get Unix seconds. Multiply by 1000 when going the other direction.

Python

Python makes this conversion almost too easy.

import time
from datetime import datetime, timezone

# Current Unix timestamp
now = int(time.time())
print(now)  # e.g., 1753401600

# Convert a specific datetime to Unix timestamp
dt = datetime(2026, 7, 25, tzinfo=timezone.utc)
ts = int(dt.timestamp())
print(ts)  # 1753401600

# Convert Unix timestamp back to datetime
converted = datetime.fromtimestamp(1753401600, tz=timezone.utc)
print(converted)  # 2026-07-25 00:00:00+00:00

One gotcha: datetime.fromtimestamp() without a tz argument returns local time. Always pass tz=timezone.utc unless you specifically want the system's local time zone.

Command Line (Linux / macOS)

The date command handles conversions without any scripting.

# Current Unix timestamp
date +%s
# Output: 1753401600

# Convert timestamp to readable date (Linux)
date -d @1753401600
# Output: Sat Jul 25 00:00:00 UTC 2026

# Convert timestamp to readable date (macOS)
date -r 1753401600

# Convert a date string to timestamp (Linux)
date -d "2026-07-25 00:00:00 UTC" +%s
# Output: 1753401600

Using an Online Converter

When you just need a quick answer and do not want to fire up a terminal or write code, an online tool saves time. The FastUnix Timestamp Converter lets you paste any timestamp and instantly see the corresponding date, or enter a date and get the Unix timestamp back. It handles both seconds and milliseconds formats.

Common Mistakes When Converting Timestamps

Confusing Seconds and Milliseconds

This is the number one error. JavaScript uses milliseconds. Unix systems use seconds. If you pass a 13-digit millisecond value to a function expecting seconds, you get a date roughly 44,000 years in the future.

// Wrong: treating milliseconds as seconds
const wrong = new Date(1753401600);
// Result: January 21, 1970 — not what you wanted

// Correct: multiply by 1000
const correct = new Date(1753401600 * 1000);
// Result: July 25, 2026

Quick rule: 10 digits means seconds. 13 digits means milliseconds.

Forgetting the Time Zone

Unix timestamps are always UTC. When you convert to a human-readable format, the result depends on your system's time zone setting.

from datetime import datetime, timezone

ts = 1753401600

# UTC — always the same
utc = datetime.fromtimestamp(ts, tz=timezone.utc)
print(utc)  # 2026-07-25 00:00:00+00:00

# Local time — varies by machine
local = datetime.fromtimestamp(ts)
print(local)  # Could be 2026-07-25 08:00:00 on a UTC+8 machine

If your application serves users across multiple time zones, store everything as Unix timestamps and convert to local time only at the display layer.

Integer Overflow in Legacy Systems

A 32-bit signed integer maxes out at 2,147,483,647. That corresponds to January 19, 2038 at 03:14:07 UTC. After that moment, 32-bit systems will wrap to negative numbers — the so-called Year 2038 problem.

Most modern systems use 64-bit integers, which will not overflow for another 290 billion years. But if you are working with embedded systems, old databases, or legacy APIs, this is still a real concern.

Practical Scenarios

Parsing API Responses

Most REST APIs return timestamps as integers. Here is how you typically handle them:

// API response
const response = {
  id: 42,
  created_at: 1753401600,
  updated_at: 1753488000
};

// Convert for display
function formatDate(ts) {
  return new Date(ts * 1000).toLocaleDateString('en-US', {
    year: 'numeric',
    month: 'long',
    day: 'numeric',
    hour: '2-digit',
    minute: '2-digit'
  });
}

console.log(formatDate(response.created_at)); // "July 25, 2026, 12:00 AM"

Filtering Database Records

import time
from datetime import datetime, timezone, timedelta

# Records from the last 7 days
seven_days_ago = int((datetime.now(timezone.utc) - timedelta(days=7)).timestamp())

query = f"SELECT * FROM events WHERE created_at > {seven_days_ago}"
# Result: SELECT * FROM events WHERE created_at > 1752796800

Generating Cache Keys

Unix timestamps make excellent cache-busting keys because they are monotonically increasing:

import time

cache_key = f"user_profile_{user_id}_{int(time.time())}"
# Result: "user_profile_42_1753401600"

FAQ

What is the difference between a timestamp and Unix time?

In everyday usage, they are the same thing. "Unix time" specifically refers to the seconds-since-epoch system. "Timestamp" is a broader term that can refer to any time representation, but in developer contexts it almost always means a Unix timestamp.

How do I know if my timestamp is in seconds or milliseconds?

Count the digits. A 10-digit number is seconds (standard Unix timestamp). A 13-digit number is milliseconds (JavaScript convention). If you see a 16-digit number, it is likely microseconds or nanoseconds.

Can Unix timestamps represent dates before 1970?

Yes, but only as negative numbers. For example, -315619200 represents January 1, 1960. Most systems handle negative timestamps correctly, but some older libraries and databases do not.

Why does JavaScript use milliseconds instead of seconds?

JavaScript was designed in the mid-1990s when millisecond precision was considered important for browser-based applications (animations, timers, etc.). The Date object was modeled after Java's java.util.Date, which also used milliseconds.

Is Unix time affected by leap seconds?

No. Unix time ignores leap seconds entirely. Each day is treated as exactly 86,400 seconds. This means Unix time gradually drifts from true UTC by the number of leap seconds that have been inserted since 1972 (currently 27 seconds). For most applications this does not matter, but precision-critical systems (GPS, financial trading) need to account for it.

Conclusion

Converting timestamp to unix time is a fundamental skill that every developer needs. The concept is simple — count the seconds from January 1, 1970 — but the practical details (seconds vs milliseconds, UTC vs local time, 32-bit overflow) are where bugs hide.

The key takeaways:

  • Unix timestamps are time zone agnostic integers, making them ideal for storage and comparison
  • Always clarify whether you are working with seconds or milliseconds before converting
  • Convert to local time only at the display layer, never in your data model
  • Use online tools like the FastUnix Timestamp Converter for quick lookups when you do not want to write code

For related tasks, you can also use the FastUnix JSON Formatter to inspect timestamp values in API responses, or the URL Encoder when passing timestamps as URL parameters.