What Is a Unix Timestamp? Converting Seconds to Dates
Last updated: · 4 min read
Databases, API responses and file systems often store a date as a single number such as 1700000000. That number counts the seconds since midnight UTC on 1 January 1970, and it is called a Unix timestamp or epoch time. This guide explains how to read the number, how a 10-digit seconds value differs from a 13-digit milliseconds value, and how to turn it into UTC, RFC 2822 and other formats. The example uses the real output of the Unix Timestamp Converter.
Formula
POSIX definition (seconds since the epoch, leap seconds not counted): seconds = sec + min×60 + hour×3600 + day_of_year×86400 + (year−1970)×31536000 + leap_years_since_1970×86400 In this tool: 1. A 13-digit value is already milliseconds: ms = value 2. A 10-digit value is seconds: ms = value × 1000 3. Days = ⌊seconds ÷ 86400⌋; the second of the day = seconds mod 86400 4. Hours = ⌊second of day ÷ 3600⌋; minutes and seconds follow the same way
The definition comes from the POSIX specification (Seconds Since the Epoch). Every day is counted as exactly 86 400 seconds, so leap seconds are ignored. The year, month and day are then taken from the total day count using the Gregorian calendar rules: a leap year every four years, except century years that are not divisible by 400. When a date text is entered, it is parsed with JavaScript's Date.parse and the millisecond value is returned.
What the inputs mean
- Timestamp or date
- A Unix value in seconds (for example 1700000000) or in milliseconds (13 digits, for example 1700000000000). A date text such as 2023-11-14T22:13:20Z also works; without a time zone, local time is assumed.
- Source
- “Use the input” converts the value above; “Use the current time” shows the timestamp of the present moment.
Worked example: Converting the value 1700000000
- Input: 1700000000 (10 digits, so seconds). Source: Use the input.
- Because it has 10 digits, the millisecond value is 1700000000 × 1000 = 1700000000000: Unix (milliseconds): 1700000000000.
- The day count is ⌊1700000000 ÷ 86400⌋ = 19675 days, which falls on 14 November 2023. The remaining 80000 seconds equal 22 hours, 13 minutes and 20 seconds.
- The tool gives the UTC value: UTC (ISO 8601): 2023-11-14T22:13:20.000Z.
- The RFC 2822 format writes the same moment as: RFC 2822: Tue, 14 Nov 2023 22:13:20 +0000.
Result: The second 1700000000 is 14 November 2023 at 22:13:20 UTC. In a time zone that is three hours ahead of UTC, the same moment reads 15 November 2023 at 01:13:20.
How to read the result
Always check the unit first: 10-digit values are seconds and 13-digit values are milliseconds. Using the wrong unit moves the date either to 1970 plus a few thousand years or back to a date in early 1970. Store values in UTC and convert them to local time only when showing them to a user. Seconds held in a signed 32-bit integer overflow in 2038 (the value 2147483647 is 19 January 2038, 03:14:07 UTC).
Common mistakes
- Reading a millisecond value as seconds. 1700000000000 interpreted as seconds sends the date tens of thousands of years into the future.
- Forgetting the time zone. Unix time is always UTC; printing it without conversion shows the wrong hour for local users.
- Trying to count leap seconds. In the POSIX definition every day has 86 400 seconds, so systems that smear or insert leap seconds can differ by a second.
- Assuming a local date text is UTC. A text such as 2023-11-15 01:13 without a zone is parsed with the browser's local time zone.
- Ignoring the 2038 limit. A signed 32-bit counter of seconds overflows in 2038, and old systems may show negative dates.
Frequently asked questions
Why does Unix time start on 1 January 1970?
It is the reference point chosen for the first Unix systems. The POSIX standard keeps it as the epoch, so the date is still the zero point today.
How do I know whether a value is seconds or milliseconds?
Count the digits. Current second values have 10 digits and millisecond values have 13. The converter separates them by this rule.
Is a negative timestamp valid?
Yes. Dates before 1 January 1970 are negative; for example −1 is 31 December 1969 at 23:59:59 UTC.
Does this tool send the date I enter to a server?
The conversion runs in your browser on the page. Even so, it is good practice to share only the value you need when the data is sensitive.
The result is not exact or binding and is for information only; it is not an official document and cannot be used in official procedures. Confirm it with the competent authority or a professional before acting; no liability is accepted for losses arising from its use.