-
-
Save laixintao/142347c7a2e00c432b8004c0ab4ce3bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
在命令行将python timestamp转换成人类可读的时间 | |
Usage: pytp 1514131200 | |
2017-12-25 00:00:00 +0800 | |
""" | |
from __future__ import unicode_literals | |
import sys | |
import time | |
if __name__ == '__main__': | |
timestamp = int(sys.argv[1]) | |
print(time.strftime('%Y-%m-%d %H:%M:%S %z',time.localtime(timestamp))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment