Convert a UNIX timestamp into a date

Was just googling for a fast way to convert a timestamp into a date without having to leave the shell (yes, I’m lazy 😉 ) and thanks to Anton found some solutions:
clipped from

BASH: Convert Unix Timestamp to a Date

Awk has a wrapper for the standard C strftime function:
echo $EPOCH|awk ‘{print strftime(”%c”,$1)}’
# date -d @1000000042
Sun Sep  9 01:47:22 GMT 2001
But this only works on newer versions of date.  It fails on my FC2 server and my Debian Sarge machine, but works fine on Ubuntu Feisty and Debian Etch.

Discussion Area - Leave a Comment