How to convert a Unix timestamp to a readable date using command line tools.
Using Perl link
1
2
| TIMESTAMP=1173279767
perl -e "print scalar(localtime($TIMESTAMP))"
|
Using Perl with ctime module link
1
2
| TIMESTAMP=1173279767
perl -e "require 'ctime.pl'; print &ctime($TIMESTAMP);"
|
Using Shell with awk link
1
| echo 1173279767 | awk '{print strftime("%c",$1)}'
|
Using Shell with date link
1
2
| TIMESTAMP=1173279767
date -d "1970-01-01 $TIMESTAMP sec GMT"
|
Or even simpler:
Last updated
11 Dec 2009, 21:38 +0200. history