Converting Unix Timestamp to Date
How to convert a Unix timestamp to a readable date using command line tools.
Using Perl
| TIMESTAMP=1173279767
perl -e "print scalar(localtime($TIMESTAMP))"
|
Using Perl with ctime module
| TIMESTAMP=1173279767
perl -e "require 'ctime.pl'; print &ctime($TIMESTAMP);"
|
Using Shell with awk
| echo 1173279767 | awk '{print strftime("%c",$1)}'
|
Using Shell with date
| TIMESTAMP=1173279767
date -d "1970-01-01 $TIMESTAMP sec GMT"
|
Or even simpler: