What is UNIX time?


What is UNIX time?

1. What is Unix Time?

Unix time is total number of seconds measured since 01-Jan-1970 00:00:00. This time format is used in all the Unix flavors for time computing activities such as dates associated with files/
, etc. This date , 1-Jan-1970 00:00:00 is also called epoch date.

2. How to find the Unix time ?

The date command with %s option :

$ date '+%s'

This number is the total number of seconds elapsed since 01-Jan-1970 till now.

3. Can we calculate the Unix time for a specific date time?

Yes, using the -d option (available in
GNU date

To get the timestamp for the date time which is 2 days ago:

$ date -d "2 days ago" '+%s'

To get the Unix time for a specific date : 1-Feb-2012 10 hours 25 mins 15 secs:

$ date -d "2010-02-01 10:25:15 " '+%s'

4. Is it possible to calculate the date time from Unix time?

Yes, it is possible using the -d option.

$ date -d@1334141505
Wed Apr 11 16:21:45 IST 2012

5. What is the Year 2038 problem?

This Unix time is stored in a structure which is 32 bit. Using a 32 bit structure, time can be provided for a defined period beyond which the number cannot be stored in a 32 bit structure and hence will start overflowing. This period is identified as to be falling on 19 January 2038. Beyond this date, Unix time will start showing past dates due to the negative value resulting in overflow. Hence, after 19 Jan 2038, this time cannot be stored and hence the year 2038 problem. However, systems with 64 bit structure to store the time will not get affected by this.

For detailed references:


What is UNIX time?






What is UNIX time?