Blog

Time, timestamps
and how to handle them.

Practical guides on Unix timestamps, JWT tokens, timezone handling and date conversion — for developers who work with real systems.

What this blog covers

Almost every system stores time as a number somewhere: a created_at column, a log line, a cache TTL, the exp claim inside a login token. These guides explain how that number works and where it tends to go wrong, with code you can copy and check against the free tools on UnixLi.

The scope is deliberately narrow: Unix timestamps and epoch time; seconds versus milliseconds, the reason a date suddenly shows up as January 1970; JWT expiration and the exp, iat and nbf claims; timezones, UTC offsets and daylight saving time; Discord timestamp tags; and language guides for JavaScript, Python and PostgreSQL, plus tool pages for PHP, Go and Rust.

Articles are written by Hassan Ben. Most examples reuse the same reference value, 1715429912 (Saturday, May 11, 2024, 12:18:32 UTC), so you can paste it into the Unix Timestamp Converter and compare the output with the code.

All articles 6 posts
JavaScript May 13, 2026 8 min read

How to Convert Unix Timestamps in JavaScript — Complete Guide

Every method you need: Unix seconds vs milliseconds, Date conversion, Intl formatting, timezone handling, relative time, and TypeScript branded types. No library required.

Read article →
Fundamentals May 13, 2026 5 min read

Unix Seconds vs Milliseconds: The Bug That Haunts Every Developer

Why your timestamp shows 1970, how to detect precision automatically, and the rules for every language and API you'll encounter.

Read article →
JWT May 14, 2026 7 min read

How to Decode and Validate JWT Expiration Without a Library

Read the exp, iat, and nbf claims from any JWT token using pure JavaScript — no jsonwebtoken, no dependencies. With Python, PHP and Go examples.

Read article →
Fundamentals May 14, 2026 7 min read

What is Epoch Time? Unix Timestamps Explained for Developers

Why time starts on January 1, 1970, how Unix timestamps work, famous epoch timestamps, the Year 2038 problem, and how to get the current epoch in every language.

Read article →
Python May 15, 2026 8 min read

Unix Timestamps in Python: datetime, timezone, and the UTC Trap

Why fromtimestamp() lies to you, why utcfromtimestamp() is deprecated, and the correct patterns for timezone-aware datetimes. With zoneinfo, pytz, strftime, and pandas.

Read article →
PostgreSQL May 16, 2026 9 min read

PostgreSQL Timestamps: TIMESTAMPTZ vs TIMESTAMP and How to Query by Unix Epoch

Why TIMESTAMP without timezone is a production bug, TO_TIMESTAMP(), EXTRACT(EPOCH), AT TIME ZONE, DATE_TRUNC, range query patterns, index tips, and schema best practices.

Read article →

Start here

New to timestamps, or debugging a date that looks wrong? These four pages cover the basics most other problems build on.

🕰
What is epoch time?

Why time starts on January 1, 1970, how the count works, and the Year 2038 problem.

🔢
Seconds vs milliseconds

The digit rule: 10 digits means seconds, 13 means milliseconds, and how to detect it in code.

⏱
Unix Timestamp Converter

Turn seconds, milliseconds or microseconds into UTC and local dates, and ISO 8601 dates back into Unix time.

🔑
JWT expiration explained

Read exp, iat and nbf without a library. All three are Unix seconds, as RFC 7519 requires.

Tools by topic

Each tool runs entirely in your browser, so nothing you paste is sent to a server. Use them alongside the articles to check your own values.

🔓
JWT Decoder

Decode a token payload and see exp, iat and nbf as readable dates. Inspection only, no signature check.

🌍
Timezone Converter

See one Unix timestamp across 13 timezones with DST-aware offsets, or watch a live world clock.

💬
Discord Timestamp Generator

Build <t:unix:style> tags for every style flag, from short time to relative “2 years ago”.

↔️
Timestamp Difference

Exact duration between two moments in seconds, hours, days and business days.

Language guides. JavaScript: the complete conversion guide and the JavaScript timestamp tool. Python: datetime and the UTC trap and the Python timestamp tool. SQL: PostgreSQL TIMESTAMPTZ vs TIMESTAMP. Tool pages with ready-to-copy snippets also exist for PHP, Go and Rust.

Frequently asked questions

How do I tell if a timestamp is in seconds or milliseconds?

Count the digits. For dates between 2001 and 2286, a 10-digit value is Unix seconds and a 13-digit value is milliseconds. 16 digits usually means microseconds and 19 digits nanoseconds. The Unix Timestamp Converter detects the precision automatically.

Why does my converted date show January 1970?

Almost always because a value in seconds was passed to something that expects milliseconds. In JavaScript, new Date(1715429912) returns January 20, 1970, while new Date(1715429912 * 1000) returns May 11, 2024. Multiply seconds by 1000 before creating the Date. The seconds vs milliseconds guide covers every major language.

What unit does the JWT exp claim use?

Unix seconds. RFC 7519 defines exp, iat and nbf as NumericDate values, which count seconds since 1970-01-01 UTC. Compare exp against Math.floor(Date.now() / 1000), not Date.now(). The JWT Decoder shows all three as readable dates.

Does a Unix timestamp depend on the timezone?

No. A Unix timestamp counts seconds since 1970-01-01 00:00:00 UTC and is the same everywhere. The timezone only matters when you format it for display: 1715429912 is 12:18:32 in UTC, 14:18:32 in Paris and 08:18:32 in New York. Try it in the Timezone Converter.