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
$
Written by Bryan Hughes
Related protips
1 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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#