Timestamp Converter
Convert Unix timestamps to human-readable dates (ISO 8601, UTC, local, relative) and convert dates back to Unix epoch time instantly in your browser.
Unix Timestamp → Human-Readable Date
Date / Time → Unix Timestamp
What is a Unix Timestamp?
A Unix timestamp is an integer representing the number of seconds elapsed since the Unix epoch — January 1, 1970 at 00:00:00 Coordinated Universal Time (UTC). It is also commonly called epoch time or POSIX time. Because it is timezone-agnostic, Unix timestamps are the universal currency of time in computing: databases store them, APIs return them, and log files record them. A single integer is far more portable than a formatted date string, which requires parsing rules, locale handling, and timezone context to interpret correctly.
How to Use This Tool
The converter works in both directions. To convert a timestamp to a human-readable date, enter a numeric Unix timestamp into the input field. The tool automatically detects whether it is in seconds (typically 10 digits, representing dates from 2001 through 2286) or milliseconds (13 digits, as returned by JavaScript's Date.now() and many REST APIs). Use the s / ms toggle to override the automatic detection if your value is ambiguous.
To go the other direction — converting a date string to a timestamp — type any recognizable date into the same input. Supported formats include ISO 8601 (2024-03-29T00:00:00Z), plain date strings (March 29 2024 or 2024-03-29), and RFC 2822 formatted strings. The tool outputs both the seconds and milliseconds representations simultaneously. Click the Now button at any time to populate the input with the current Unix timestamp, which is useful for quickly checking the current epoch value or establishing a reference point before calculating time differences. All processing runs locally in your browser — no timestamp is ever sent to a server.
Output Formats Explained
- ISO 8601 — The international standard format:
2024-03-29T00:00:00.000Z. Used in APIs, JSON payloads, and HTMLdatetimeattributes. The trailingZexplicitly denotes UTC, eliminating ambiguity. - UTC — The long-form UTC date string:
Fri, 29 Mar 2024 00:00:00 GMT. Used in HTTP headers such asDate,Last-Modified, andExpires. - Local — The timestamp converted to your browser's local timezone. Useful for verifying that a UTC timestamp corresponds to the correct local time for your region.
- Relative — A human-friendly relative description: "2 hours ago", "in 3 days". Helpful for quickly understanding whether a timestamp is recent or distant without doing date arithmetic.
Common Use Cases
The most common scenario is debugging API responses that return numeric epoch values. When a REST endpoint returns "created_at": 1711670400, pasting that number here immediately tells you the human-readable date without writing a one-off script. Similarly, log files from servers and cloud services often record events as Unix timestamps — converting them helps correlate events across services that may be in different timezones.
Developers working with cron jobs frequently need to verify that a scheduled time corresponds to the correct epoch value. You can use this tool to find the timestamp for a future date and then cross-check it against your scheduler configuration. To set up recurring tasks based on time, Cron Expression Builder pairs well with this tool. Calculating time differences between two events is straightforward once both are expressed as integers — subtract one from the other and divide by 3600 for hours or 86400 for days. Comparing timestamps across timezones is also simplified because epoch values are always UTC: two timestamps from different systems can be directly compared numerically without any timezone conversion.
Database engineers often need to troubleshoot timestamp columns that store integers rather than datetime types. Pasting the raw value here confirms the stored date and helps identify off-by-one errors caused by seconds vs. milliseconds mismatches. When APIs return JSON with embedded timestamps, JSON Formatter can help structure the response before you extract the timestamp values for conversion.
Best Practices & Tips
Always store timestamps in UTC. Storing local time in a database creates ambiguity during daylight saving transitions and makes it impossible to reliably sort or compare records from users in different regions. Unix timestamps are inherently UTC, which is one reason they remain the preferred storage format in most backend systems.
Choose the right unit for your platform. Use milliseconds for JavaScript and frontend work — Date.now() returns milliseconds, and the Date constructor expects milliseconds. Use seconds for Unix shell scripting, Python's time.time(), and most SQL databases. A common bug is passing a milliseconds timestamp to a function expecting seconds, producing a date in the year 33658.
Be explicit about timezone offsets when displaying timestamps to users. Always convert UTC epoch to the user's local timezone at render time, not at storage time. Use Intl.DateTimeFormat in JavaScript or pytz / zoneinfo in Python for reliable timezone-aware formatting.
Use ISO 8601 for human-readable logging. When writing timestamps to log files that humans will read, ISO 8601 with a Z suffix is unambiguous and sortable lexicographically. Watch out for Y2038 on 32-bit systems — signed 32-bit integers overflow at Unix timestamp 2147483647, which corresponds to January 19, 2038. Validate that your timestamp input falls within a reasonable range before conversion, particularly when processing user-supplied data.
Unix Time in Programming
Every major language has built-in support for Unix timestamps.
- JavaScript:
Date.now()returns milliseconds;Math.floor(Date.now() / 1000)gives seconds. Convert back withnew Date(ts * 1000). - Python:
import time; time.time()returns a float in seconds. Usedatetime.fromtimestamp(ts)to convert. - SQL:
UNIX_TIMESTAMP()in MySQL,EXTRACT(EPOCH FROM NOW())in PostgreSQL.
Related Guides
- Unix Timestamps & Epoch Time Guide — everything about epoch time, Y2038, and timezone pitfalls
- Epoch to Date Conversion in 6 Languages — code snippets for JS, Python, Go, Java, PHP, and Rust
- Cron Syntax: Fields, Examples & Tips — schedule tasks using Unix time
FAQ
What is a Unix timestamp?
A Unix timestamp (also called epoch time) is the number of seconds that have elapsed since January 1, 1970 at 00:00:00 UTC. It is a simple, timezone-independent way to represent a point in time used universally in programming and databases.
What is the difference between seconds and milliseconds timestamps?
Most Unix timestamps are in seconds (10 digits for dates around 2001–2286). JavaScript's Date.now() and many APIs return milliseconds (13 digits). This tool supports both — use the s/ms toggle to select the correct unit.
Is the Y2038 problem real?
Yes. Systems that store Unix timestamps as a signed 32-bit integer will overflow on January 19, 2038 at 03:14:07 UTC. Modern 64-bit systems and languages like JavaScript (which uses 64-bit floats) are not affected, but legacy embedded systems and old databases may still be at risk.
How do I get the current Unix timestamp?
In JavaScript: Date.now() returns milliseconds; Math.floor(Date.now() / 1000) gives seconds. In Python: import time; int(time.time()). In Bash: date +%s. In SQL (PostgreSQL): EXTRACT(EPOCH FROM NOW())::int.
What date formats can I input?
ISO 8601 (2024-03-29T00:00:00Z), common date strings (March 29 2024, 2024-03-29), and RFC 2822 format (Fri, 29 Mar 2024 00:00:00 +0000). Ambiguous formats without a timezone are interpreted as local time.
Related Articles
Epoch to Date: Convert Unix Timestamps in JS, Python, Go, Java, PHP & Rust
Convert epoch to date in JavaScript, Python, Go, Java, PHP, and Rust. Copy-paste code snippets with timezone-aware examples and common pitfalls.
Unix Timestamps & Epoch Time Guide
What epoch time is and how to convert Unix timestamps in JavaScript, Python, and Go. Covers the Y2038 problem, timezone pitfalls, and millisecond precision.