35% Discount on Residential Proxies for 9 months - use code WING35 at checkout

Get The Deal

Unix Time

What is Unix Time?

Unix time (or ‘unixtime’) is a system that represents a point in time by counting the number of seconds elapsed since a fixed reference moment. That reference is called the Unix epoch (00:00:00 UTC on January 1, 1970).

Unix timestamps basically store values as simple numbers. Many computer systems and Linux machines adopt Unix time as their base timekeeping method.

Unix Time’s Origins

The idea of Unix time or unixtime came from early Linux and Unix operating systems, intended as a compact and consistent time format. It’s also known as POSIX time in many Linux-based environments. 

Different systems have adopted Unix time, where it is used as a unifying data format for time data. The choice of January 1, 1970, as the Unix epoch was arbitrary but provided a solid baseline for inter-system synchronization.

How to Calculate Unix Time

To compute Unix time, you count the number of non-leap seconds that have passed since the Unix epoch in UTC and exclude leap years and seconds. For example, for any date or dates after 1 January 1970, you subtract the epoch and convert the difference into seconds. 

When dealing with time zones, you first convert local times into UTC before doing the calculation. Because Unix time ignores leap seconds, each day is treated as exactly 86,400 seconds, meaning it can diverge from true atomic/UTC time when leap seconds are inserted.

Most days in Unix time are counted as exactly 86,400 seconds. This means adding one day typically increases the timestamp by 86,400 (leap-second days are the only exception).

When using JavaScript, we can get the current Unix value by calling Date.now() (which gives milliseconds since the epoch), then dividing by 1000 to get the Unix stamp in seconds.

Unix Time’s Common Uses

Unix time is commonly used for storing timestamps in databases, logs, APIs, and file formats. Systems store time values in a uniform way using this time format.

Because it avoids ambiguity around time zones and local times, this data format is preferred when exchanging values between systems. Many web APIs return Unix timestamps so clients and servers can translate them into human-readable date formats. It is also used in sorting by time order, scheduling, and in event logging across computer systems.