Many UNIX application are using an EPOCH time to determine a date, on most Linux systems an EPOCH time started on 1.1.1970 and will end on 18.1.2038 as defined by a time_t UNIX C library. Epoch time digit contains a number of seconds since the start of epoch ( 1.1.1970 and 10 hours ).

To get a better understanding consider an example where epoch number is "1". Now convert this epoch time to a real time/ When using bash we can execute a following command:

~$ date --date "Jan 1, 1970 00:00:00 +0000 + 1 seconds"
Thu Jan  1 10:00:01 EST 1970

To get a current epoch time we simply use date command as follows:

~$ date +%s

As already mentioned above, to convert a epoch time digit to real time we can use for example by

~$ date --date "Jan 1, 1970 00:00:00 +0000 + 1284763671 seconds"
Sat Sep 18 08:47:51 EST 2010


date -d@1284763671
Sat Sep 18 08:47:51 EST 2010


~$ perl -e 'print scalar(localtime(1284763671)), "\n"'
Sat Sep 18 08:47:51 2010


To convert to Coordinated Universal Time using bash type:

~$ date -ud@1284763671
Fri Sep 17 22:47:51 UTC 2010

Free Linux eBooks

Do you have the right skills?

Our IT Skills Watch page reflects an up to date IT skills demand leaning towards the Linux and Unix environment. We have considered a number of skills and operating systems.

See the result...

Go to top