Unix Timestamp Converter
Convert epoch timestamps to human-readable dates and back. Live counter, timezone support, and instant copy.
What Is a Unix Timestamp?
A Unix timestamp (or epoch time) counts the number of seconds since January 1, 1970 00:00:00 UTC - a moment known as the Unix epoch. This convention was chosen when Unix was created in the early 1970s, and it became the de facto standard for representing time in computing. Every operating system, database, and programming language understands epoch time. The value is always relative to UTC, making it timezone-independent: the same integer maps to the same instant everywhere on Earth. One common source of confusion is seconds vs milliseconds - most Unix systems use 10-digit second timestamps, while JavaScript and Java use 13-digit millisecond timestamps. This tool auto-detects which you entered. A related concern is the Year 2038 problem: 32-bit signed integers overflow on January 19, 2038. Modern 64-bit systems are unaffected, but legacy embedded devices may need updates.
Convert Unix Timestamps in Code
Here are copy-paste snippets for converting timestamps in popular languages. Remember: JavaScript and Java use milliseconds, while most other languages use seconds.
# To date
datetime.fromtimestamp(ts, tz=timezone.utc)
# To epoch
int(time.time())
// To date (seconds input)
new Date(ts * 1000)
// To epoch
Math.floor(Date.now() / 1000)
-- MySQL: To date
FROM_UNIXTIME(ts)
-- MySQL: To epoch
UNIX_TIMESTAMP()
-- PostgreSQL: TO_TIMESTAMP(ts)
// To date
date('Y-m-d H:i:s', $ts)
// To epoch
time()
// To date
Instant.ofEpochSecond(ts)
// To epoch
Instant.now().getEpochSecond()
// To date
DateTimeOffset.FromUnixTimeSeconds(ts)
// To epoch
DateTimeOffset.UtcNow.ToUnixTimeSeconds()
# To date (GNU Linux)
date -d @$ts
# To date (macOS)
date -r $ts
# To epoch
date +%s
// To date
time.Unix(ts, 0)
// To epoch
time.Now().Unix()
Convert Unix Timestamps in Spreadsheets
Working with epoch timestamps in spreadsheets is common when exporting data from databases or APIs. Watch out for the seconds vs milliseconds gotcha - if your timestamps have 13 digits, divide by 1000 first.
- Excel: Formula:
=(A1/86400)+DATE(1970,1,1). Format the cell as Date/Time. For milliseconds, use=(A1/86400000)+DATE(1970,1,1). - Google Sheets: Same formula as Excel. Newer versions also support
=EPOCHTODATE(A1)for seconds and=EPOCHTODATE(A1,2)for milliseconds. - BigQuery:
TIMESTAMP_SECONDS(ts)for 10-digit timestamps.TIMESTAMP_MILLIS(ts)for 13-digit.TIMESTAMP_MICROS(ts)for 16-digit. - Snowflake:
TO_TIMESTAMP(ts)for seconds.TO_TIMESTAMP(ts, 3)for milliseconds. The second parameter specifies the scale.
How to Use This Tool
- View Current Timestamp: View the current Unix timestamp at the top of the page - it updates every second.
- Convert Timestamp to Date: Paste or type a timestamp in the left panel. The tool auto-detects whether it is seconds or milliseconds.
- Convert Date to Timestamp: Use the date picker in the right panel to convert a date to a Unix timestamp.
- Change Timezone: Use the timezone dropdown to see dates in any timezone.
- Copy Output: Click the copy icon next to any output to copy it to your clipboard instantly.
Date Format Standards: RFC 2822 and ISO 8601
When converting Unix timestamps to human-readable dates, two industry-standard formats are commonly used. Understanding when and where each is used helps ensure your data integrates smoothly with other systems.
- ISO 8601: The international standard format:
2024-01-15T14:30:45.123+0800. Used in APIs, JSON responses, logging systems, and databases. Sortable as a string, timezone-aware, and unambiguous across regions. - RFC 2822: Email and HTTP header format:
Mon, 15 Jan 2024 14:30:45 +0800. Used in email timestamps (Date header), HTTP headers (Last-Modified, Date), and some legacy systems. Human-readable but less suitable for automation. - When to Use Each: Use ISO 8601 for APIs, databases, and logs - it sorts correctly and parses reliably. Use RFC 2822 when sending emails or working with HTTP headers. Most modern systems default to ISO 8601.
Who Uses This Tool
- Backend Developers: Debugging API responses, database records, and log entries that store timestamps as integers. Quickly verify that a stored epoch value maps to the expected date.
- Data Engineers: Converting epoch columns during ETL pipelines, data migrations, and transformations in BigQuery, Snowflake, or Spark. Validating that timestamp conversions produce correct results.
- DevOps / SRE: Correlating log timestamps across systems that use different timezone conventions. Converting alert timestamps to local time during incident response.