Last Updated: February 25, 2016
·
765
· blhughes

Print readable format of unix timestamp

Here is a quick script I have in ~/bin/ called ts to convert unix timestamps like "1396472917" into readable date formats like "Wed Apr 2 15:08:37 2014"

#!/bin/env python
import sys,time

print time.ctime(float(sys.argv[1]))
$ ts 1396472917
Wed Apr  2 15:08:37 2014
$

1 Response
Add your response

You can use date tool on Linux:

$ date -d @1396472917
Wed Apr  2 18:08:37 BRT 2014

You can use date options and format:

$ date -d @1396472917  +%Y-%m-%d
2014-04-02
over 1 year ago ·