How to Read Unix Time 1

The 1,000,000,000 seconds since epoch was celebrated at a party held by DKUUG in Copenhagen, Denmark 2001-09-09 03:46:40.

Source: Author : Chlor/Antaya

When you are using the Unix console a lot, you will sooner or later stumble across Unix time. These timestamps represent seconds elapsed since 1970-01-01 00:00:00, which is called the Unix epoch. What I want to show you in this tip is, how to read Unix time on the console.

For example 1388573100 represents Wed Jan 1 11:45:00 CET 2014.

In the near future there is one date coming up where interesting things might happen. The dooms day is January 19th 2038 at 03:14:08 UTC, where all 32-bit signed integer representations of the unix time will overflow and turn into a negative number. More details about this issue can be found at Wikipedia.

Convert a date to Unix time

To convert Unix time back and forth is quite simple as long as you have the GNU date command available on your computer.

Using the +”%s” format string is the way to display the specified date in Unix time. This shows the current time:

$ date +"%s"

If you want to convert a specific date into Unix time, the command should look like this:

$ date -d "2014-01-01 11:44:00" +"%s"

Unix time to readable format

The other way around, to convert Unix time back into something readable, is much more unknown and the syntax is somewhat hard to remember. To Convert the above example into it’s readable form run

$ date -d '1970-01-01 UTC 1388573100 seconds'
Wed Jan  1 11:45:00 CET 2014

Leave a comment

Your email address will not be published. Required fields are marked *


One thought on “How to Read Unix Time