Unix Timestamp Converter — Complete Guide With Code Examples
A Unix timestamp converter transforms a 10-digit integer representing seconds since January 1 1970 into a human readable date and time, and back again. To convert instantly, use the free Unix Timestamp Converter at discordtimestampgenerator.com — paste your number and get the exact date, time, and Discord timestamp code in one click.
What Is A Unix Timestamp Converter?
A Unix timestamp converter is a tool that reads a numeric timestamp and outputs a readable date, or reads a date and outputs the numeric timestamp. The reference point for every Unix timestamp is January 1 1970 at 00:00:00 UTC, known as the Unix epoch. A timestamp of 0 represents that exact moment, and every second since then adds 1 to the count.
As of mid-2026, current Unix timestamps sit above 1,784,000,000 — a 10-digit number. This 10-digit length is the fastest way to tell seconds apart from milliseconds, which run 13 digits long.
How Do You Convert A Unix Timestamp To A Date?
Divide the timestamp by the correct unit if needed, then feed it into your language's date constructor. In JavaScript, multiply by 1000 first because Date expects milliseconds. In Python, pass the raw integer seconds value directly into datetime.fromtimestamp().
new Date(1784123456 * 1000).toISOString()
from datetime import datetime, timezone
datetime.fromtimestamp(1784123456, tz=timezone.utc)
date -d @1784123456
SELECT FROM_UNIXTIME(1784123456);
Always check the digit count before converting. A 13-digit number divided incorrectly by 1 instead of 1000 will land you in the year 58,000 — a common bug in production logging systems.
How Do You Convert A Date To A Unix Timestamp?
Take the date, set it to UTC, and count the seconds elapsed since the epoch. Most languages handle this with a single built-in method rather than manual math.
Math.floor(new Date('2026-07-17T00:00:00Z').getTime() / 1000)
import datetime
int(datetime.datetime(2026, 7, 17, tzinfo=datetime.timezone.utc).timestamp())
strtotime('2026-07-17 UTC')
date -u -d "2026-07-17" +%s
For a bidirectional check without writing code, the Unix Timestamp Converter tool handles both directions on one page — paste a timestamp for a date, or pick a date for a timestamp.
Why Does Discord Require Seconds Instead Of Milliseconds?
Discord's native timestamp system reads the number as seconds, not milliseconds. A 13-digit millisecond value pasted into a Discord timestamp tag renders a date thousands of years in the future because Discord treats every digit as a second. Always confirm you have a 10-digit second-based value before generating a Discord timestamp code.
The generated code looks like this, always kept on its own line:
<t:1784123456:F>
Since January 2026, Discord also supports a direct @time mention shortcut inside messages, letting users insert a localized timestamp without manually building the tag — the newest and easiest method available, and one most competing guides still don't cover.
What Are The Most Common Unix Timestamp Conversion Mistakes?
Three mistakes account for most conversion errors reported in developer forums and Stack Overflow threads. First, confusing seconds with milliseconds — JavaScript's Date.now() returns milliseconds while PHP's time() returns seconds. Second, forgetting to force UTC, which causes a date to shift by your local timezone offset, sometimes landing on the wrong calendar day entirely. Third, treating the Year 2038 problem as irrelevant — systems still storing timestamps in a signed 32-bit integer will overflow at 03:14:07 UTC on January 19 2038, corrupting any date calculation performed after that second.
How Do You Convert A Unix Timestamp In Different Languages?
| Language | Timestamp to Date | Date to Timestamp |
|---|---|---|
| JavaScript | new Date(ts * 1000) | Math.floor(Date.now() / 1000) |
| Python | datetime.fromtimestamp(ts, tz=timezone.utc) | int(datetime.now(timezone.utc).timestamp()) |
| PHP | date('Y-m-d H:i:s', $ts) | time() |
| Bash | date -d @$ts | date +%s |
| MySQL | FROM_UNIXTIME(ts) | UNIX_TIMESTAMP() |
| Java | Instant.ofEpochSecond(ts) | Instant.now().getEpochSecond() |
When debugging across a stack that mixes languages, standardize on seconds everywhere and only convert to milliseconds at the exact point a JavaScript Date object is constructed. Mixed-unit bugs are the single most reported timestamp issue in cross-language systems.
What Is The Difference Between Epoch Time And Unix Time?
Epoch time and Unix time refer to the same underlying system in nearly all practical contexts — a count of seconds from a fixed reference point. The term "epoch" technically refers to the reference date itself, while "Unix time" refers to the counting system built on that reference. Some operating systems use different epoch dates: macOS Classic used January 1 1904, and Windows FILETIME uses January 1 1601, but modern Unix, Linux, JavaScript, Python, and Discord all use the January 1 1970 UTC epoch.
Frequently Asked Questions
Ready to generate Discord timestamps?
Open the Generator