You need to convert Epoch seconds to a human-readable date and time.
Use the GNU date command with your desired format from Recipe 11.1, “Formatting Dates for Display”:
1 2 3 4 5 6 7 |
EPOCH='1131173989' $ date -d "1970-01-01 UTC $EPOCH seconds" +"%Y-%m-%d %T %z" 2005-11-05 01:59:49 -0500 $ date --utc --date "1970-01-01 $EPOCH seconds" +"%Y-%m-%d %T %z" 2005-11-05 06:59:49 +0000 |
Since Epoch seconds are simply the number of seconds since the Epoch (which is Midnight on January 1, 1970, also known as 1970-01-01T00:00:00), this command starts at the Epoch, adds the Epoch seconds, and displays the date and time as you wish.
If you don’t have GNU date on your system you can try one of these Perl one-liners:
1 2 3 4 5 6 7 8 9 10 11 |
EPOCH='1131173989' $ perl -e "print scalar(gmtime($EPOCH)), qq(\n);" # UTC Sat Nov 5 06:59:49 2005 $ perl -e "print scalar(localtime($EPOCH)), qq(\n);" # Your local time Sat Nov 5 01:59:49 2005 $ perl -e "use POSIX qw(strftime); print strftime('%Y-%m-%d %H:%M:%S', localtime($EPOCH)), qq(\n);" 2005-11-05 01:59:49 |