Unix Timestamp & Epoch Conversion Tools


The current Unix Epoch Time is: 

Convert Timestamp To Human-Readable Date

Supports Unix timestamps in seconds, milliseconds, microseconds and nanoseconds.

GMT:
Your Local Time:

Convert Human-Readable Date To Timestamp


Timestamp in milliseconds:
Unix Timestamp:
GMT:
Your Local Time:

Convert Seconds To Days, Hours & Minutes


Timestamp for Start and End of Day


Start of Day (Unix Timestamp):
End of Day (Unix Timestamp):

What is the Unix Time Stamp?

Unix Time, also referred to as Epoch Time, POSIX Time, Seconds since the Epoch, or UNIX Epoch Time, is a method used to represent a point in time. It counts the number of seconds that have elapsed between a specific date and January 1, 1970, at Coordinated Universal Time (UTC). Thus, the Epoch marks Unix time 0 (January 1, 1970), and the term is interchangeably used with Unix Time or Unix Timestamp. Many Unix systems store Unix Time as a signed 32-bit integer, which will reach its limit at 3:14:08 UTC on January 19, 2038. This is known as the Year 2038 problem, where the 32-bit signed Unix time will overflow and cause the count to roll over into the negative.

Human Readable TimeSecondsMinutesHours
1 Minute6010.016667
1 Hour3600601
1 Day86400144024
1 Week60480010080168
1 Month (30.44 days)262974443829.0667730.4844
1 Year (365.24 days)31556926525948.7678765.813

Transform a human-readable date and time into an epoch timestamp


PHPstrtotime parses most English language date texts to epoch/Unix Time.
echo strtotime("May 15, 2024");
// ... or ...
echo strtotime("05/15/2024");
// ... or ...
echo strtotime("+10 days"); // 10 days from now
// object oriented
$date = new DateTime('05/15/2024'); // format: MM/DD/YYYY
echo $date->format('U');
JavaScriptvar myDate = new Date("September 12, 1985 09:23:00"); // Your timezone!
var myEpoch = myDate.getTime()/1000.0;
document.write(myEpoch);
Perluse Time::Local;
$time = timelocal($sec,$min,$hours,$day,$month,$year);
Pythonimport calendar, time; calendar.timegm(time.strptime('2024-05-15 10:07:09', '%Y-%m-%d %H:%M:%S'))

Convert an epoch timestamp to a human-readable date and time.


PHP$epoch = 1715756829; $dt = new DateTime("@$epoch"); // convert UNIX timestamp to PHP DateTime echo $dt->format('Y-m-d H:i:s'); // output = 2024-05-15 10:07:09
JavaScriptvar myDate = new Date("September 12, 1985 09:23:00"); // Your timezone!
var myEpoch = myDate.getTime()/1000.0;
document.write(myEpoch);
Perluse Time::Local;
$time = timelocal($sec,$min,$hours,$day,$month,$year);
Pythonimport time; time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime(epoch)) Replace
time.localtime with time.gmtime for GMT time. Or using datetime: import datetime; datetime.datetime.utcfromtimestamp(epoch).replace(tzinfo=datetime.timezone.utc)
next sta Unix time, also known as POSIX time or Epoch time, represents the number of seconds that have elapsed since the Unix epoch (00:00:00 UTC on 1 January 1970). It can be represented in any numerical form, often as a string of decimal digits in textual applications. However, binary representations of Unix time are particularly significant in computing. Time Representations and the Year 2038 Problem
The Unix `time_t` data type traditionally encodes time as a signed 32-bit integer. This 32-bit representation covers approximately 68 years before and after the 1970-01-01 epoch, with a minimum date of Friday 1901-12-13 and a maximum of Tuesday 2038-01-19. On 2038-01-19 at 03:14:07 UTC, one second later will cause an overflow known as the Year 2038 problem.
64-bit Solution
Newer operating systems have expanded `time_t` to 64 bits, significantly extending the representable range to about 292.3 billion years in both directions. This 64-bit range exceeds twenty times the current age of the universe, effectively eliminating the overflow issue.
Signed vs. Unsigned Debate
There was initial debate over whether `time_t` should be signed or unsigned. An unsigned 32-bit `time_t` would double the range into the future, postponing the overflow by 68 years. However, it would then be incapable of representing times before the epoch. Consensus favors a signed `time_t`, and this remains the usual practice. Notably, version 6 of the QNX operating system uses an unsigned 32-bit `time_t`.
Standards Compliance
POSIX and Open Group Unix specifications include the C standard library, which defines time types and functions in the header file. The ISO C standard requires `time_t` to be an arithmetic type but doesn't specify its exact form. POSIX mandates that `time_t` be an integer type but leaves the signed/unsigned distinction open.
Sub-second Precision
Unix doesn't directly represent non-integer Unix time numbers as binary fractions. Instead, sub-second precision is managed using composite data types: - **`struct timeval`:** An integral `time_t` (whole seconds) and a fractional part in millionths of a second. - **`struct timespec`:** An integral `time_t` and a fractional part in billionths of a second. These composite structures offer a fixed-point decimal-based format, suitable for various applications and easy to convert.
Summary
- **Unix Time (`time_t`):** Traditionally a signed 32-bit integer, representing approximately 68 years before and after 1970. - **Year 2038 Problem:** Overflow issue due to 32-bit limit, resolved with a 64-bit `time_t`. - **64-bit `time_t`:** Expands the range to about 292.3 billion years. - **Signed vs. Unsigned:** Consensus on signed `time_t` for backward compatibility. - **Sub-second Precision:** Managed with composite structures like `struct timeval` and `struct timespec`. This concise overview provides a unique perspective on the intricacies of Unix time representation. Unix time, initially created for Unix system timekeeping, has since been embraced across diverse computing platforms. It's now embedded in most system programming APIs, whether on Unix-based or non-Unix systems. Modern programming languages provide ways to manipulate Unix time or convert it to different data structures. Programming APIs & Standard LibrariesC Standard Library: Central to Unix time's adoption, the C standard library employs Unix time for all its date and time functions. The POSIX specification defines this as the system time API, naming the data type time_t for timestamps in C/C++. The C standard library is widely used across desktop operating systems like Microsoft Windows, macOS, and Linux, adhering to the standard programming interface.
Swift & iOS: The Swift API for iOS defaults to an epoch of January 1, 2001, but can also work with Unix timestamps.
Android: Unix time, coupled with a timezone, forms the basis of Android's system time API.
Windows: Although not used internally, Windows includes Unix time in its C++-based APIs adhering to the C standard library specification. It's also present in the PE format for Windows executables.
Programming Languages
Java: Uses the Instant object for Unix timestamps (in seconds and nanoseconds). Python: Provides a time library utilizing Unix time. JavaScript: Offers a Date library storing timestamps in milliseconds since the Unix epoch, available across all modern web browsers and JavaScript server environments like Node.js.
File Systems & Data Storage
Unix-Based Filesystems: APFS: Apple’s default file system, storing timestamps in Unix time (nanoseconds). ext4: Commonly used on Linux and Android, also storing timestamps in Unix time (nanoseconds). Archive File Formats: Unix time appears in RAR and tar file formats for timestamp storage.
Databases:
MySQL and PostgreSQL both incorporate Unix time for timestamp storage. Unix time has become a universal timekeeping standard, embedded in modern software systems, programming languages, file formats, and databases, making it indispensable for developers globally.
Unix time isn't the sole method for measuring time from a specific starting point, or epoch. In contrast, Windows utilizes the FILETIME format, which measures time in 100-nanosecond intervals since midnight GMT on January 1, 1601. This Windows-specific epoch is crucial for recording file timestamps and is employed in various protocols like the Active Directory Time Service and Server Message Block.
Another time-keeping standard, the Network Time Protocol, which synchronizes time across computer networks, starts its count from January 1, 1900. This protocol uses two unsigned 32-bit integers, one for seconds and the other for fractional seconds, and experiences a rollover approximately every 136 years.
Additionally, numerous applications and programming languages support time storage with specified time zones. There are also several human and machine-readable time format standards, such as ISO 8601, designed to facilitate easy reading and processing.
Celebrations of Unix time
Unix time has inspired enthusiasts to host "time_t parties," reminiscent of New Year's festivities, to mark notable moments in Unix time, particularly when the time_t value reaches round decimal numbers, aligning with Unix traditions. Some groups also celebrate significant binary numbers, like +230, which was observed at 13:37:04 UTC on Saturday, January 10, 2004.
While these celebrations often mark "N seconds since the Unix epoch," it’s technically inaccurate due to Unix time's handling of leap seconds, meaning the actual number of seconds since the epoch can be slightly higher than the Unix time number for dates post-epoch.
Significant milestones include:
The first occurrence of the date in ISO 8601 format within the digits of Unix time at 18:36:57 UTC on October 17, 1973. The Unix billennium, celebrated at 01:46:40 UTC on September 9, 2001, when Unix time reached 1,000,000,000 seconds. This milestone, a blend of "billion" and "millennium," caused minor sorting errors in some software applications, like KNode and KMail from KDE, due to the shift from a leading digit of 9 to 1. Most issues were quickly resolved with community-driven patches. The moment when Unix time hit 1234567890 seconds at 23:31:30 UTC on February 13, 2009, was marked globally with events and even a Google doodle, reflecting its significance within various tech communities.