Unix Timestamp → Date
Date → Unix Timestamp
Timeline Position
See where your timestamp falls between the Unix Epoch and 2100
Quick Timestamps
What Is a Unix Timestamp?
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC — a reference point known as the Unix epoch. It is the standard way computers represent a point in time as a single number.
For example, the timestamp 1700000000 represents November 14, 2023 at 22:13:20 UTC. The timestamp 0 represents the epoch itself: January 1, 1970 at midnight UTC.
Why developers use Unix timestamps
- Timezone-independent: A timestamp always represents the same instant worldwide. No ambiguity about time zones, daylight saving, or date formats.
- Easy to compare: To check which event happened first, compare two integers. No date parsing needed.
- Simple arithmetic: Add 86,400 to get the same time tomorrow. Subtract two timestamps to get the difference in seconds.
- Compact storage: A single 32-bit or 64-bit integer vs. separate year, month, day, hour, minute, second fields.
- Universal support: Every programming language, database, and operating system understands Unix timestamps.
Seconds vs. Milliseconds Timestamps
Some systems store timestamps in seconds (10 digits), others in milliseconds (13 digits). Confusing the two is one of the most common timestamp bugs.
| Unit | Example | Digits | Used By |
|---|---|---|---|
| Seconds | 1700000000 | 10 | Unix/Linux, Python, PHP, MySQL, PostgreSQL, C |
| Milliseconds | 1700000000000 | 13 | JavaScript, Java, Elasticsearch, MongoDB |
Quick rule: If the number is 13 digits, divide by 1,000 to get seconds. If it is 10 digits, it is already in seconds.
Common Date Formats
This converter outputs timestamps in several standard formats. Here is what each one means:
| Format | Example | When to Use |
|---|---|---|
| ISO 8601 | 2023-11-14T22:13:20.000Z | APIs, databases, data interchange. Unambiguous, sortable as a string. |
| RFC 2822 | Tue, 14 Nov 2023 22:13:20 GMT | Email headers, HTTP headers, RSS feeds. |
| UTC | Tue, 14 Nov 2023 22:13:20 GMT | Logs, debugging, any context where UTC is required. |
| Local time | 11/14/2023, 5:13:20 PM | User-facing display. Format varies by browser locale. |
Tip: For APIs and data storage, use ISO 8601 or Unix timestamps. For display to users, use local time with explicit timezone indication.
Getting Timestamps in Code
JavaScript
// Current timestamp (seconds)
Math.floor(Date.now() / 1000)
// Timestamp to date
new Date(1700000000 * 1000)
// Date to timestamp
Math.floor(new Date('2023-11-14').getTime() / 1000)
Note: JavaScript uses milliseconds natively. Divide by 1000 for seconds.
Python
import time
from datetime import datetime
# Current timestamp (seconds)
int(time.time())
# Timestamp to date
datetime.utcfromtimestamp(1700000000)
# Date to timestamp
int(datetime(2023, 11, 14).timestamp())
Terminal (Linux / macOS)
# Current timestamp
date +%s
# Timestamp to date
date -d @1700000000 # Linux
date -r 1700000000 # macOS
# Specific date to timestamp
date -d '2023-11-14' +%s # Linux
SQL (MySQL / PostgreSQL)
-- Current timestamp (MySQL)
SELECT UNIX_TIMESTAMP();
-- Timestamp to date (MySQL)
SELECT FROM_UNIXTIME(1700000000);
-- Current timestamp (PostgreSQL)
SELECT EXTRACT(EPOCH FROM NOW())::int;
-- Timestamp to date (PostgreSQL)
SELECT TO_TIMESTAMP(1700000000);
Notable Timestamps
| Event | Timestamp | Date (UTC) |
|---|---|---|
| Unix Epoch | 0 | Jan 1, 1970 00:00:00 |
| Y2K | 946684800 | Jan 1, 2000 00:00:00 |
| 1 Billion Seconds | 1000000000 | Sep 9, 2001 01:46:40 |
| 2 Billion Seconds | 2000000000 | May 18, 2033 03:33:20 |
| Y2K38 Overflow | 2147483647 | Jan 19, 2038 03:14:07 |
The Year 2038 Problem (Y2K38)
Many older systems store Unix timestamps as 32-bit signed integers. The maximum value a 32-bit signed integer can hold is 2,147,483,647, which corresponds to January 19, 2038 at 03:14:07 UTC.
One second later, the value overflows to −2,147,483,648, which the system interprets as December 13, 1901. This can cause crashes, data corruption, and incorrect date calculations in affected software.
The fix: Modern systems use 64-bit integers for timestamps. A 64-bit signed integer can represent dates up to approximately 292 billion years in the future — far beyond any practical need. Most current operating systems, databases, and programming languages have already migrated to 64-bit timestamps.
Who is still at risk? Embedded systems, legacy firmware, and older 32-bit applications that have not been updated. If you maintain systems that store timestamps as 32-bit integers, plan the migration before 2038.
Common Mistakes
- Confusing seconds and milliseconds: A 13-digit number is milliseconds; a 10-digit number is seconds. Feeding milliseconds into a function expecting seconds gives a date tens of thousands of years in the future.
- Ignoring time zones: Timestamps are always UTC. Converting to a local date without applying the correct timezone offset produces wrong results. Always use timezone-aware date functions.
- Assuming all months are 30 days: To add "one month" to a timestamp, don't just add 2,592,000 seconds (30 days). Use a proper date library that handles varying month lengths and leap years.
- Storing timestamps as strings: A timestamp is a number. Storing it as a string wastes space and makes comparisons slower. Use integer columns in databases.
- Not handling negative timestamps: Dates before January 1, 1970 are valid and represented as negative numbers (e.g., −86400 = December 31, 1969). Some older libraries fail on negative values.
- Using local time for storage: Store timestamps in UTC. Convert to local time only for display. Mixing local times from different timezones in the same database leads to subtle, hard-to-find bugs.
When to Use Unix Timestamps vs. Other Formats
| Scenario | Best Format | Why |
|---|---|---|
| Database storage | Unix timestamp or TIMESTAMP column | Compact, timezone-safe, fast to compare |
| API responses | ISO 8601 string or Unix timestamp | ISO 8601 is human-readable; timestamps are unambiguous |
| Log files | ISO 8601 with timezone | Readable when debugging, sortable as text |
| User-facing display | Localized date/time | Humans need readable dates in their local format |
| Date arithmetic | Unix timestamp | Simple integer addition/subtraction |
| Historical dates (before 1970) | ISO 8601 | Negative timestamps work but are less intuitive |
Frequently Asked Questions
What is a Unix timestamp?
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC — a reference point known as the Unix epoch. For example, the timestamp 1700000000 represents November 14, 2023 at 22:13:20 UTC. Timestamps are timezone-independent, making them the standard way to represent time in computing.
How do I convert a Unix timestamp to a readable date?
Enter the timestamp into the converter above for instant results. In code: in JavaScript, use new Date(timestamp * 1000) (JavaScript uses milliseconds). In Python, use datetime.fromtimestamp(timestamp). In a terminal, run date -d @1700000000 on Linux or date -r 1700000000 on macOS.
How do I convert a date to a Unix timestamp?
Use the "Date → Unix Timestamp" panel above. In code: in JavaScript, Math.floor(new Date('2023-11-14').getTime() / 1000). In Python, int(datetime(2023, 11, 14).timestamp()). In a terminal, date -d '2023-11-14' +%s on Linux.
What is the difference between seconds and milliseconds timestamps?
A seconds-based timestamp is 10 digits (e.g., 1700000000). A milliseconds-based timestamp is 13 digits (e.g., 1700000000000). JavaScript, Java, and some APIs use milliseconds. Unix/Linux, Python, PHP, and most databases use seconds. To convert: divide milliseconds by 1,000 to get seconds, or multiply seconds by 1,000 to get milliseconds.
What is the Year 2038 problem?
Many older systems store Unix timestamps as 32-bit signed integers. The maximum value is 2,147,483,647, which corresponds to January 19, 2038 at 03:14:07 UTC. After this moment, the timestamp overflows to a negative number, which is interpreted as a date in December 1901. Modern 64-bit systems are not affected — they can represent dates billions of years into the future.
Why do Unix timestamps start from 1970?
January 1, 1970 was chosen when Unix was being developed at Bell Labs in the early 1970s. The date was recent enough to be practical for the computing needs of the time, and it has since become the universal reference point for time in computing across virtually all operating systems and programming languages.
Can Unix timestamps represent dates before 1970?
Yes. Dates before the epoch are represented as negative numbers. For example, December 31, 1969 at 23:59:59 UTC is timestamp -1. January 1, 1960 would be approximately -315619200. Most modern languages handle negative timestamps correctly, though some legacy systems may not support them.
What is ISO 8601?
ISO 8601 is an international standard for date and time representation. The format is YYYY-MM-DDTHH:mm:ss.sssZ, where T separates the date and time, and Z indicates UTC. Example: 2023-11-14T22:13:20.000Z. It is the recommended format for APIs and data interchange because it is unambiguous, sortable as text, and includes timezone information.
How do I get the current Unix timestamp?
Click the "Now" button in the converter above. In code: JavaScript — Math.floor(Date.now() / 1000). Python — int(time.time()). PHP — time(). Terminal — date +%s. The current timestamp is also displayed live at the top of this page.
Does this converter store my data?
No. All conversions run entirely in your browser using JavaScript. No timestamps or dates are sent to any server. Nothing is stored or logged.
Related Tools
- Date Difference Calculator — calculate the number of days, weeks, or months between two dates
- Time Zone Converter — convert times between different time zones
- Date Add/Subtract Calculator — add or subtract days, weeks, or months from a date
- Crontab Generator — generate cron schedule expressions for automated tasks
- Countdown Timer — set a timer to a specific date and time
- Unix Timestamps Explained — in-depth guide to epoch time, conversions, and programming examples
Privacy & Limitations
- Client-side only. No data is sent to any server. No cookies, no tracking of timestamps or dates entered. All conversions run in your browser using JavaScript.
- JavaScript precision. JavaScript numbers are 64-bit floating point (IEEE 754). Timestamps are accurate to millisecond precision. Extremely large timestamps (beyond year 275,760) may lose precision.
- Local time depends on your browser. The "Local" format uses your browser's timezone and locale settings. If your system clock or timezone is configured incorrectly, local time output will be wrong. UTC and ISO 8601 outputs are not affected.
- Leap seconds are not modeled. Unix time does not count leap seconds. Each day is exactly 86,400 seconds. This matches the behavior of virtually all computer systems but differs slightly from astronomical time (UTC).
Related Tools
View all toolsAge Calculator
Calculate age from a birthdate
Date Difference Calculator
Calculate days between two dates
Time Zone Converter
Convert time between time zones
Time Zone Offset Visualizer
Visualize UTC offsets and time differences across multiple time zones
Working Days Calculator
Count business days between dates with holiday exclusions
Week Number Calculator
Find ISO week number for a date
Unix Timestamp Converter FAQ
What is a Unix timestamp?
A Unix timestamp (also called epoch time or POSIX time) is the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC — a reference point known as the Unix epoch. For example, the timestamp 1700000000 corresponds to November 14, 2023 at 22:13:20 UTC. Timestamps are timezone-independent, making them ideal for storing and comparing times across systems.
How do I convert a Unix timestamp to a readable date?
Multiply the timestamp by 1000 if your language uses milliseconds (like JavaScript), then create a date object. In JavaScript: new Date(1700000000 * 1000). In Python: datetime.fromtimestamp(1700000000). In PHP: date('Y-m-d H:i:s', 1700000000). Or use an online converter like this one for instant results.
What is the difference between seconds and milliseconds timestamps?
A seconds-based timestamp is 10 digits (e.g., 1700000000). A milliseconds-based timestamp is 13 digits (e.g., 1700000000000). JavaScript, Java, and some APIs use milliseconds. Unix/Linux, Python, PHP, and most databases use seconds. To convert milliseconds to seconds, divide by 1000.
What is the Year 2038 problem?
The Year 2038 problem (Y2K38) occurs because many older systems store Unix timestamps as 32-bit signed integers. The maximum value is 2,147,483,647, which corresponds to January 19, 2038 at 03:14:07 UTC. After this point, 32-bit timestamps overflow and wrap to negative values. Modern systems use 64-bit integers, which can represent dates billions of years into the future.
Why do Unix timestamps start from 1970?
The Unix epoch of January 1, 1970 was chosen when Unix was being developed at Bell Labs in the early 1970s. The date was recent enough to be practical for the computing needs of the time, while being a clean starting point. It has since become the universal standard for timestamp systems across virtually all operating systems and programming languages.
What is ISO 8601 date format?
ISO 8601 is an international standard for date and time representation. The format is YYYY-MM-DDTHH:mm:ss.sssZ, where T separates date and time, and Z indicates UTC. Example: 2023-11-14T22:13:20.000Z. ISO 8601 is used in APIs, databases, and data interchange because it is unambiguous, sortable as a string, and timezone-aware.
How do I get the current Unix timestamp?
In a terminal: run 'date +%s' (Linux/macOS). In JavaScript: Math.floor(Date.now() / 1000). In Python: import time; int(time.time()). In PHP: time(). The current timestamp increments by 1 every second.
Can Unix timestamps represent dates before 1970?
Yes. Dates before January 1, 1970 are represented as negative timestamps. For example, December 31, 1969 at 23:59:59 UTC is timestamp -1. Most modern programming languages and databases handle negative timestamps correctly, though some older systems may not support them.
Does this converter store my data?
No. All conversions run entirely in your browser using JavaScript. No timestamps or dates are sent to any server. Nothing is stored or logged.