Dates & Calendars

What Is Unix Time? Epoch Timestamps Explained (With Converter)

Unix time counts seconds since 1 January 1970 UTC. Convert timestamps to dates and back, why leap seconds are ignored, milliseconds, and the 2038 problem.

What Is Unix Time? Epoch Timestamps Explained (With Converter)
In this article
  1. Unix timestamp converter
  2. How it works
  3. Seconds or milliseconds?
  4. Time zones
  5. Leap seconds are ignored
  6. The year 2038 problem
  7. Getting the current timestamp
  8. Your age as a timestamp
  9. Converting timestamps in databases
  10. Other epochs
  11. Common mistakes
  12. Round-number moments
  13. Frequently asked questions
  14. Sources

Unix time — also called epoch time or a POSIX timestamp — is the number of seconds since 00:00:00 UTC on 1 January 1970, not counting leap seconds. On 22 October 2026 at midnight UTC it was 1,792,627,200. Almost every computer, phone and database uses it internally, because a single number is easy to store, sort and compare across time zones.

Unix timestamp converter

Paste a timestamp to see the date in UTC and in your own time zone, or pick a date to get its timestamp.

Loading the calculator…

How it works

The moment 1970-01-01T00:00:00Z is timestamp 0. This is the “Unix epoch.” Every day adds exactly 86,400 seconds. This simplifies time tracking. It provides a constant daily increment. A unix timestamp converter calculates seconds since the epoch. This finds the timestamp for a date.

For example, if you want to find the timestamp for 1 January 1970, 01:00:00 UTC, you add 3,600 seconds (60 minutes * 60 seconds) to the epoch: 0 + 3,600 = 3,600. Similarly, 1 hour before the epoch is -3,600.

Timestamp Date and time (UTC)
0 1 January 1970, 00:00:00
86,400 2 January 1970, 00:00:00
1,000,000,000 9 September 2001, 01:46:40
1,700,000,000 14 November 2023, 22:13:20
2,000,000,000 18 May 2033, 03:33:20
2,147,483,647 19 January 2038, 03:14:07

Dates before 1970 have negative timestamps: 1 January 1969 is −31,536,000. These negative numbers extend the timeline backwards from the epoch, allowing for consistent representation of historical dates.

Seconds or milliseconds?

Unix time primarily uses seconds. However, many modern systems and programming languages require higher precision and use milliseconds since the epoch. This results in a much larger number. JavaScript’s Date.now() returns milliseconds. Java’s System.currentTimeMillis() also returns milliseconds. These are typically 13-digit numbers today.

Python’s time.time() returns seconds with a decimal for fractional seconds, giving you high precision without switching to milliseconds. Most databases and APIs use whole seconds, which are 10-digit numbers. Always check the expected unit when working with timestamps.

If a converted date appears to be in the year 58,000, you likely fed a 13-digit millisecond timestamp into a seconds unix timestamp converter. To fix this, simply divide the millisecond timestamp by 1,000 before converting it.

Unix timestamp converter: A person checking a sports watch, showing time.

Time zones

A Unix timestamp is inherently time zone-agnostic. It always counts from midnight UTC. This makes it a universal time reference point. Time zones become relevant for a unix timestamp converter. This happens when it converts the timestamp into a human-readable local date and time. For example, 1,792,627,200 always represents 22 October 2026, 00:00:00 UTC. This is true regardless of your location.

A UTC-centric approach avoids classic local time bugs. Daylight-saving changes cause many issues. A local hour can happen twice (fall back) or not at all (spring forward). Storing local time can lead to ambiguity or errors. Use a unix timestamp converter for precise records. Storing timestamps (or ISO 8601 dates with a time zone, such as 2026-10-22T09:30:00+05:00) provides an unambiguous record. This simplifies global data synchronization.

You should use Unix timestamps for storing event times, log entries, or any data that needs a precise, universal time reference. Only convert to local time when you display the information to a user, allowing them to see it in their preferred time zone.

Old spectacles on a world map, suggesting travel or global perspective.

Leap seconds are ignored

UTC has included 27 leap seconds since 1972. However, Unix time intentionally ignores these. It simplifies calculations by pretending each day has exactly 86,400 seconds. This means Unix time does not perfectly track Coordinated Universal Time (UTC) for events that happen exactly on a leap second.

Systems handle leap second discrepancies. Some repeat the timestamp for the extra second. For example, 23:59:59 becomes 23:59:60. Then it becomes 00:00:00 the next day. A unix timestamp converter might show 23:59:59 twice. Other systems “smear” the leap second. They slow the clock over several hours. This distributes the extra second. The operating system and its time sync method determine this.

You can always compute the date from a timestamp using simple division. This is because Unix time maintains a consistent count of seconds from the epoch. However, the number of “real” seconds (as defined by UTC) between two Unix timestamps can be off. The offset can be up to the total number of leap seconds introduced, currently 27. This discrepancy is usually irrelevant for most applications. But it impacts high-precision timing, such as satellite navigation or scientific measurements. A unix timestamp converter should account for this.

The good news is that we will abolish leap seconds by 2035, as decided by the BIPM. This future change means Unix time will more closely align with UTC, simplifying timekeeping for everyone.

A red alarm clock ringing with motion blur and lightning bolts.

The year 2038 problem

Older systems store Unix time in a signed 32-bit integer. This data type holds positive values up to 2,147,483,647. This maximum value represents 03:14:07 UTC on 19 January 2038. One second later, the counter overflows. The value “wraps around” to its minimum negative value. This corresponds to 13 December 1901 for a unix timestamp converter.

Overflow causes severe issues. Programs misinterpret future dates as past. Data could corrupt. Systems might crash. This problem affects legacy embedded devices, and older operating systems. File formats not updated to use larger integer types are also affected. Check critical systems or data storage methods. This applies to those relying on 32-bit timestamp storage, especially when using a unix timestamp converter.

Modern systems use 64-bit integers for storing Unix time. If you are developing new systems or updating existing ones, always use 64-bit time representations to avoid this issue. Embedded devices and old file formats may still need a unix timestamp converter fix before 2038.

Disassembled clock parts, including face, hands, and brass casing.

Getting the current timestamp

Retrieving the current Unix timestamp is a common operation in programming. Here are examples for various environments:

  • Linux / macOS terminal: Use the date command with the +%s format specifier.

    date +%s

    This returns the current time in seconds since the epoch.

  • JavaScript: Get milliseconds using Date.now() and divide by 1000 to get seconds.

    Math.floor(Date.now() / 1000)

    Use Math.floor() to ensure you get a whole number for seconds.

  • Python: The time module provides a function to get the current time in seconds.

    int(time.time())

    time.time() returns a float, so cast it to an integer to get whole seconds.

  • PHP: The time() function directly returns the current Unix timestamp.

    time()

  • Excel: Calculate the difference in days from the epoch and multiply by seconds in a day.

    =(NOW()-DATE(1970,1,1))*86400

    NOW() returns the current local date and time. Remember to adjust for your UTC offset if you need a true UTC timestamp.

  • Java: Get milliseconds and divide.

    System.currentTimeMillis() / 1000L

    The L ensures the division is performed using a long integer.

  • Go: Use the time package.

    time.Now().Unix()

    This returns the current time in seconds since the epoch.

  • Ruby: The Time class provides a method for this.

    Time.now.to_i

    to_i converts the time object to an integer representing seconds.

Your age as a timestamp

Unix time is a continuous count of seconds, making it ideal for measuring durations, including human lives. You can calculate your age in seconds by subtracting your birth timestamp from the current timestamp. The how many seconds old am I counter, a unix timestamp converter, shows this live. This method provides a precise, unambiguous age calculation that automatically accounts for varying month lengths and leap years, unlike simple year-based calculations.

Converting timestamps in databases

Databases often provide built-in functions to convert between Unix timestamps and native date/time formats. Understanding these functions is crucial for storing and retrieving time-based data efficiently and accurately.

System Timestamp → date Date → timestamp
MySQL FROM_UNIXTIME(ts) UNIX_TIMESTAMP(dt)
PostgreSQL to_timestamp(ts) EXTRACT(EPOCH FROM dt)
SQLite datetime(ts, 'unixepoch') strftime('%s', dt)
SQL Server DATEADD(second, ts, '1970-01-01') DATEDIFF_BIG(second, '1970-01-01', dt)

Watch for time zones. MySQL’s FROM_UNIXTIME returns the session’s local time. PostgreSQL’s to_timestamp returns a time-zone-aware value. Always specify UTC. Convert to UTC before storing. Convert after retrieving to maintain consistency. This applies across databases and applications. For example, in MySQL, adjust the session time zone. Or use CONVERT_TZ for explicit UTC handling. This is if your application expects UTC, useful for a unix timestamp converter.

A person typing on a keyboard with a coffee mug and computer monitors.

Other epochs

While Unix time is widely adopted, 1970 is not the only starting point computers use for tracking time. Different systems and applications define their own epochs based on their specific needs or historical context. Mixing these up is a common source of errors when working with dates and times across different platforms.

A vintage green alarm clock on a white background.
  • Windows FILETIME: This epoch begins on 1 January 1601. It measures time in 100-nanosecond intervals, offering extremely high precision. You will encounter this in Windows API calls and file system timestamps.
  • Excel: Excel has a peculiar epoch that starts on 1 January 1900. It treats dates as serial numbers, with 1 January 1900 being day 1. It also includes a “1900 leap-year quirk” where it incorrectly considers 1900 a leap year, which can cause off-by-one day errors for dates before March 1, 1900. Old Mac workbooks sometimes use 1 January 1904 as their epoch.
  • GPS time: This system counts seconds since 6 January 1980. Crucially, GPS time does not account for leap seconds. As a result, GPS time is currently 18 seconds ahead of UTC. This difference must be considered when synchronizing GPS data with UTC-based systems.
  • Apple Cocoa / Core Data: Apple’s frameworks use 1 January 2001 as their epoch. This simplifies calculations for applications within the Apple ecosystem, but requires conversion when interacting with Unix time or other systems.
  • NTP: The Network Time Protocol (NTP) uses 1 January 1900 as its epoch. Its original 32-bit counter rolls over in 2036, presenting a similar challenge to the Unix 2038 problem for older NTP implementations.

When a date is off by exactly 31 years (Unix to Apple Cocoa) or by 1,462 days (Unix to Excel 1904 epoch), a mix-up between these different epochs is the likely cause. Always verify the epoch definition when exchanging timestamp data between systems.

Common mistakes

Working with Unix timestamps can be straightforward, but several common pitfalls can lead to incorrect calculations or data inconsistencies. Understanding these mistakes helps you avoid them.

  • Treating local time as UTC. When you convert a date string like “2026-10-22 09:00” into a timestamp without specifying a time zone, the system often assumes it’s in the local time zone. This means the same string will produce different timestamps on servers in different geographical locations. Always specify UTC or a specific time zone when creating timestamps from date strings.
  • Seconds vs milliseconds. This is perhaps the most frequent error. A 13-digit number is almost always a millisecond timestamp, while a 10-digit number is typically a second timestamp. If you feed milliseconds into a converter expecting seconds, your date will be thousands of years in the future. Always check the expected unit of your timestamp function or API.
  • Storing birthdays as timestamps. A date of birth is a calendar date, not a precise moment in time. Converting it to a timestamp at midnight in one time zone can shift it by a day when viewed from another time zone. For example, a birth on “1990-01-01” at midnight UTC becomes “1989-12-31” in New York. Store dates of birth as plain dates (YYYY-MM-DD) to avoid these time zone complications.
  • Assuming every day is 86,400 seconds in local time. While Unix time *defines* every day as 86,400 seconds, local time experiences daylight-saving changes. On a day when daylight saving begins, the local day is 23 hours long. When it ends, the local day is 25 hours long. If you perform calculations based on local time and assume a fixed 86,400 seconds per day, your results will be incorrect for those specific days.

Round-number moments

Programmers and tech enthusiasts often celebrate when the Unix timestamp hits a significant round number. These “epoch milestones” offer a fun way to mark the passage of digital time.

  • 1,234,567,890 arrived on 13 February 2009 at 23:31:30 UTC.
  • Next, 1,500,000,000 arrived on 14 July 2017 at 02:40:00 UTC.
  • 1,800,000,000 arrives on 15 January 2027 at 08:00:00 UTC.
  • The next big one, 2,000,000,000, is on 18 May 2033 at 03:33:20 UTC.

These moments highlight the continuous, linear progression of Unix time and offer a unique perspective on our digital timeline.

Frequently asked questions

What is a Unix timestamp?

A Unix timestamp is the number of seconds that have passed since 00:00:00 UTC on 1 January 1970, ignoring any leap seconds.

Why does Unix time start in 1970?

The 1970 epoch was chosen as a convenient and round starting point during the development of the Unix operating system at Bell Labs around 1970–71.

Is a Unix timestamp in UTC?

Yes. A Unix timestamp intrinsically represents a moment in UTC. It has no associated time zone itself; converting it to a local time is a separate display step.

What happens in 2038?

Systems that still store Unix time in a signed 32-bit integer will experience an overflow at 03:14:07 UTC on 19 January 2038. The timestamp will revert to 13 December 1901, potentially causing data corruption or system failures. Modern systems using 64-bit time are unaffected.

How do I convert a Unix timestamp to a human-readable date?

You can use online converters, programming language functions (e.g., new Date(timestamp * 1000) in JavaScript), or database functions (e.g., FROM_UNIXTIME(ts) in MySQL). Remember to account for whether the timestamp is in seconds or milliseconds.

Sources

Photo of Yasir Hafeez

Written by

Yasir Hafeez is the founder and editor of ItsAgeCalculator. He builds the calculators, writes and checks the guides and articles, and tests every result against fixed date rules. He also runs OmniMatrics, a site of everyday calculators and converters.

More articles · Editorial policy · Spotted a mistake? Let us know.

Age tools