Sunday, May 10, 2009

Convert epoch timestamp (seconds since 1970) on the command line

Use this to convert epoch timestamp (seconds since 1970) on the command line. For some reason the man page doesn't reveal this secret:

date -d @1241958464
If you have the epoch seconds in hex, use this on linux:
echo $((0x4f91d6f8)) | xargs -I## date -d @##
The same thing is much easier on OS X:
date -r 0x4f91d6f8

No comments: