Free tool
Timestamp converter
This free timestamp converter turns a unix timestamp into a human date, and a date back into unix time — live, with no submit button. It auto-detects whether you pasted seconds, milliseconds, or microseconds, shows the result in your local timezone and UTC, and can batch-convert a whole list at once. Everything runs in your browser, so nothing you type is ever uploaded.
Timestamp converter
Convert unix time to date and back, live, in your browser.
Current unix time
Paste a timestamp in seconds, milliseconds, or microseconds — the unit is auto-detected from the digit count.
What is unix time?
Unix time — also called epoch time or a unix timestamp — is a way of representing a specific point in time as a single number: the count of seconds that have elapsed since the unix epoch, which is 00:00:00 UTC on January 1, 1970. Instead of storing a date as a string like “July 14, 2026, 3:42 PM,” a computer stores it as a number such as 1783007520. That single integer is unambiguous, timezone-independent, and trivially easy to compare, sort, and do math on — which is exactly why almost every programming language, database, and API uses it internally.
The name comes from the Unix operating system, where this convention originated in the early 1970s, but it is now a universal standard used everywhere from JavaScript's Date object to Python's datetime module, SQL databases, JWTs, log files, and REST APIs. When you see a field called created_at, exp, or timestamp that's just a large number, it is almost always a unix timestamp.
A timestamp is always relative to UTC, not any particular timezone — the number itself never changes no matter where in the world you are. What changes is how you choose to display it. That's the core job of a converter like this one: take the raw number and render it as a readable date in whatever timezone you care about.
Seconds vs. milliseconds vs. microseconds
The single biggest source of unix-timestamp bugs is unit confusion: treating a millisecond timestamp as seconds (or vice versa) silently produces a date that is off by a factor of 1,000 — usually landing somewhere in 1970 or the far future. There is no header or type that tells you which unit a raw number uses, so tools and developers rely on a simple heuristic: digit count.
| Unit | Digits (circa 2026) | Example | Typical source |
|---|---|---|---|
| Seconds | 10 | 1783007520 | Unix time(), SQL, JWT exp/iat, most APIs |
| Milliseconds | 13 | 1783007520000 | JavaScript Date.now(), Java System.currentTimeMillis() |
| Microseconds | 16 | 1783007520000000 | Python time.time_ns() variants, some tracing/logging systems |
This tool applies exactly that heuristic: 10 digits or fewer is read as seconds, 11–13 digits as milliseconds, and anything longer as microseconds, with a badge showing which unit was detected so you can sanity-check it. If your value looks off by 1,000x or a million x, the unit was almost certainly misidentified upstream — check the source system's documentation.
The Year 2038 problem
Many older systems store unix timestamps as a signed 32-bit integer. A signed 32-bit integer can only hold values up to 2,147,483,647 — and the unix timestamp will reach exactly that number at 03:14:07 UTC on January 19, 2038. One second later, the value overflows and wraps around to a large negative number, which many systems will interpret as a date in December 1901. This is known as the Year 2038 problem (sometimes “Y2038” or “the Epochalypse”), and it is a direct sibling of the more famous Y2K bug.
Modern 64-bit systems sidestep the problem entirely — a signed 64-bit timestamp doesn't overflow for roughly another 292 billion years — and most current operating systems, databases, and languages have already migrated to 64-bit time representations. The risk remains in embedded systems, older 32-bit hardware, legacy file formats, and databases with 32-bit date/time columns that haven't been upgraded. If you work on infrastructure with a multi-decade lifespan (industrial control systems, firmware, long-lived file formats), it's worth explicitly checking whether your timestamp fields are 32-bit or 64-bit.
Timezones, UTC, and why timestamps avoid the problem
A unix timestamp is always a count of seconds since the epoch in UTC (Coordinated Universal Time) — it has no timezone attached to it, because it doesn't need one. The number 1783007520 refers to the exact same instant everywhere on Earth, whether you're in Karachi, London, or Los Angeles. Timezone only enters the picture when you convert that number into a human-readable calendar date and clock time, because “what year, month, day, and hour is it” genuinely depends on where you are standing.
This is why storing timestamps (or any UTC-based datetime) is the right default for backend systems, databases, and APIs: it eliminates an entire category of bugs around daylight saving time transitions, server timezone misconfiguration, and ambiguous local times. You only convert to a specific timezone at the very last step, when displaying the value to a human. This tool follows that same pattern — it shows you both the UTC value (ISO 8601 format, unambiguous) and your browser's detected local timezone side by side, using the Intl.DateTimeFormat API to read your actual system timezone rather than guessing.
One subtlety worth knowing: daylight saving time (DST) means the same UTC instant can map to different UTC offsets in the same timezone depending on the time of year (e.g. America/New_York is UTC-5 in winter and UTC-4 in summer). A correct converter — including this one — resolves that automatically based on the actual date, not a fixed offset.
Get the current timestamp in code
Getting “right now” as a unix timestamp is one of the most common one-liners in programming. Here's how to do it in the languages you'll run into most often:
| Language | Snippet | Unit |
|---|---|---|
| JavaScript | Math.floor(Date.now() / 1000) | Seconds |
| JavaScript | Date.now() | Milliseconds |
| Python | int(time.time()) | Seconds |
| Python | time.time_ns() // 1_000_000 | Milliseconds |
| PHP | time() | Seconds |
| PHP | round(microtime(true) * 1000) | Milliseconds |
| SQL (Postgres) | EXTRACT(EPOCH FROM NOW()) | Seconds (float) |
| SQL (MySQL) | UNIX_TIMESTAMP() | Seconds |
Converting back to a date is just as common. In JavaScript, new Date(unixSeconds * 1000) gives you a Date object; in Python, datetime.fromtimestamp(unix_seconds); in PHP, date('Y-m-d H:i:s', $unixSeconds); and in SQL, TO_TIMESTAMP(unix_seconds) (Postgres) or FROM_UNIXTIME(unix_seconds) (MySQL). Always double-check whether the function you are calling expects seconds or milliseconds — that mismatch is, again, the most common bug in this whole space.
Common use cases for a timestamp converter
- Debugging APIs and logs. Server logs, webhook payloads, and API responses are full of raw unix timestamps. Pasting one in here instantly tells you what actually happened and when.
- Reading JWTs. JSON Web Tokens encode
iat(issued at) andexp(expiry) as unix seconds — converting them tells you exactly when a token was minted or will expire. - Database work. Many schemas store
created_atorupdated_atas integers rather than native datetime columns, especially in NoSQL stores and event logs. - Scheduling and cron jobs. Cron next-run calculations and job queues frequently pass around unix time internally — pair this with our cron expression generator when you need to go the other direction.
- QA and testing. Generating a specific past or future timestamp to test expiry logic, trial periods, or time-based feature flags.
- Blockchain and crypto. Block timestamps, transaction times, and smart contract events are almost always raw unix seconds.
Unix time vs. other date formats
Unix timestamps aren't the only way to represent a point in time, and it helps to know how they relate to the alternatives you'll run into. ISO 8601 (e.g. 2026-07-14T15:42:00Z) is a human-readable, sortable string format that's become the standard for APIs and logs where readability matters — it encodes the same instant as a unix timestamp but keeps the year, month, day, and time explicit, which makes it easier to eyeball and safer to log. RFC 2822 (e.g. Fri, 14 Jul 2026 15:42:00 +0000) shows up mostly in email headers and older HTTP date fields. Excel/spreadsheet serial dates count days (not seconds) since December 30, 1899, which is why a spreadsheet import can produce wildly wrong dates if it's mistaken for a unix timestamp — always check whether a suspiciously small or large number is meant to be days or seconds before converting it.
Unix time wins for machine-to-machine communication because it's a plain integer: cheap to store, cheap to compare, and immune to string-parsing ambiguity (is 03/04/2026 March 4th or April 3rd? A timestamp never has that problem). ISO 8601 wins when a human — or a log-scanning engineer at 2 a.m. — needs to read the value directly. Good systems often store both: a unix timestamp (or a native datetime column) for computation, and render ISO 8601 in anything meant for human eyes.
How this converter works
Everything on this page runs client-side using the browser's built-in Date and Intl APIs — there is no server round-trip, so conversions update instantly as you type and nothing you enter ever leaves your device. The “current unix time” clock reads Date.now() on an interval and re-renders every second; because that value depends on when the page loaded, it's deferred to a useEffect hook so the server-rendered HTML and the first client render always match (avoiding React hydration warnings).
The unix-to-date converter first strips non-digit characters to count digits, classifies the value as seconds, milliseconds, or microseconds using the ranges described above, then normalizes everything to milliseconds internally (the unit JavaScript's Date constructor expects) before rendering the local time, UTC string, relative time, and day of week. The relative-time string (“3 days ago,” “in 2 hours”) is produced with Intl.RelativeTimeFormat, which automatically picks the most natural unit and correct grammar for the size of the gap. The date-to-unix converter reads a datetime-local input, which has no timezone of its own, and interprets it either as your browser's local timezone (via the standard Date constructor) or as UTC (via Date.UTC), depending on which mode you select.
Tips for working with timestamps
- Always check the digit count before trusting a value — 10 digits means seconds, 13 means milliseconds.
- Store and transmit timestamps in UTC; only convert to a local timezone for display, at the last possible moment.
- Prefer ISO 8601 strings (e.g.
2026-07-14T15:42:00Z) over raw numbers in logs and APIs meant for humans to read — they're self-describing and sort correctly as text. - Negative timestamps are valid and represent dates before January 1, 1970.
- Watch for off-by-1000 errors when a function unexpectedly returns seconds where you expected milliseconds, or vice versa — this is the single most common timestamp bug.
Common timestamp mistakes to avoid
- Mixing seconds and milliseconds. Passing a seconds timestamp into a function that expects milliseconds (or the reverse) is the single most common bug. In JavaScript specifically,
new Date(unixSeconds)without multiplying by 1000 will produce a date sometime in 1970, becauseDatealways expects milliseconds. - Assuming a fixed UTC offset. Hardcoding “UTC-5” for a timezone that observes daylight saving time will be wrong for half the year. Always use a timezone-aware library or the
IntlAPI, which resolves the correct offset for the specific date in question. - Truncating instead of rounding. When converting milliseconds to seconds, using
Math.floorvs.Math.roundcan shift a boundary timestamp by a second, which occasionally matters for exact-match comparisons in tests or caching keys. - Forgetting timestamps can be negative. Dates before 1970 are valid unix timestamps — they're just negative numbers. Code that assumes timestamps are always positive (e.g. using an unsigned integer type) will break on historical dates.
- Losing precision in JSON or Excel. Very large microsecond or nanosecond timestamps can exceed the safe integer range in JavaScript (
Number.MAX_SAFE_INTEGER) or get silently rounded by spreadsheet software — treat them as strings if exact precision matters downstream.
Frequently asked questions
- What is a unix timestamp?
- A unix timestamp (also called epoch time) is the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970 — the unix epoch. It's a compact, timezone-independent way to represent an exact moment in time.
- How do I know if a timestamp is in seconds or milliseconds?
- Count the digits. As of 2026, unix seconds have 10 digits, milliseconds have 13, and microseconds have 16. This tool detects the unit automatically and shows a badge confirming which one it used.
- What is the Year 2038 problem?
- Systems that store unix time as a signed 32-bit integer will overflow at 03:14:07 UTC on January 19, 2038, wrapping around to a negative number that many systems misread as a date in 1901. Modern 64-bit systems are unaffected.
- Does a unix timestamp include a timezone?
- No. A unix timestamp is always relative to UTC and represents the same instant everywhere in the world. Timezone only matters when converting that number into a human-readable local date and time, which is what the 'local time' output on this page does using your browser's detected timezone.
- How do I get the current unix timestamp in code?
- In JavaScript: Math.floor(Date.now() / 1000) for seconds. In Python: int(time.time()). In PHP: time(). In SQL (Postgres): EXTRACT(EPOCH FROM NOW()). See the code snippet table above for milliseconds and other languages.
- Is this timestamp converter free and private?
- Yes. It's completely free with no sign-up, and every conversion happens locally in your browser using JavaScript's Date and Intl APIs — nothing you type is ever sent to a server.