Skip to main content
SnipKit

Unix Timestamps: What They Are and How to Work With Them

SnipKit Team6 min read

Every API response, log file, and JWT token has a number like 1742400000 somewhere in it. That's a unix timestamp. A unix timestamp converter turns it into a human-readable date in one click. This guide covers what the number means, where you'll find it, and how to handle seconds vs. milliseconds.

What Is a Unix Timestamp?

A unix timestamp is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC. That reference point is called the epoch.

So 1742400000 means 1.7 billion seconds since the epoch. That works out to March 19, 2025, 12:00 UTC.

Why 1970? An arbitrary choice by Unix engineers — it predates most systems they were building. The convention stuck.

Epoch time gives you a single universal number. No time zones, no locale formatting, no ambiguity.

Where You'll See Timestamps in Real Projects

Unix timestamps show up in more places than most developers expect.

API responses use them for created_at, updated_at, and expires_at fields. See a 10-digit number in a JSON date field? That's a unix timestamp. Paste the response into the JSON Formatter to explore the structure.

JWT tokens carry three timestamp fields: iat (issued at), exp (expires), and nbf (not before). When a token expires unexpectedly, check whether exp is in the past. The JWT Decoder shows these fields with human-readable dates.

Server logs stamp every event with epoch time. Compact, sortable, database-friendly. Comparing entries is just subtraction.

Databases — PostgreSQL, MySQL, SQLite — store epoch time as an integer column. Faster to index than formatted strings.

HTTP headers like Last-Modified and Expires relate to epoch time under the hood. The HTTP Status Codes reference covers how caching headers work with response codes.

Seconds vs. Milliseconds: How to Tell the Difference

This is where most bugs happen. There are two common timestamp formats:

  • 10 digits → seconds (standard Unix time). Example: 1742400000
  • 13 digits → milliseconds (JavaScript's Date.now()). Example: 1742400000000

The quick mental test: if the number is greater than 10,000,000,000 — it's milliseconds.

JavaScript uses milliseconds everywhere. Python's time.time() returns seconds as a float. Most databases and APIs use seconds. Mix them up and you get a date in 1970 or 317 years in the future — easy to spot once you know the pattern.

How to Convert Timestamps

One-liners for the three most common environments:

JavaScript

new Date(1742400000 * 1000).toISOString() // "2025-03-19T12:00:00.000Z"

Python

from datetime import datetime, timezone
datetime.fromtimestamp(1742400000, tz=timezone.utc)  # 2025-03-19 12:00:00+00:00

Bash

date -d @1742400000 -u  # Wed Mar 19 12:00:00 UTC 2025

For quick lookups, use the Unix Timestamp Converter. Paste a timestamp, get the date back instantly. It handles both seconds and milliseconds automatically.

Need to calculate how many days between two dates? The Date Calculator handles that once you have the human-readable dates.

FAQ

Why does Unix time start on January 1, 1970?

A practical choice with no special significance. Unix engineers needed a reference point that predated their systems, and 1970 fit. It became a standard simply because Unix did.

What is the Year 2038 problem?

Older systems store timestamps as a 32-bit signed integer, maxing out at 2,147,483,647 — January 19, 2038, 03:14:07 UTC. After that, the number wraps to negative, showing dates as December 1901. Modern systems use 64-bit integers and aren't affected. Worth checking if you maintain legacy C code or embedded systems.

Can unix timestamps be negative?

Yes. A negative unix timestamp represents a moment before January 1, 1970. For example, -86400 is December 31, 1969, 00:00:00 UTC. Most modern languages and databases handle negative timestamps correctly, but some older tools don't — worth testing if you're working with historical data.

Wrapping Up

Unix timestamps are everywhere — APIs, tokens, logs, databases, caches. Once you know the seconds vs. milliseconds rule, they stop being mystery numbers.

Next time you see a 10-digit number in a response, run it through the Unix Timestamp Converter. One click, instant decode.