Skip to content

Instantly share code, notes, and snippets.

@laixintao
Created September 28, 2017 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laixintao/f86f63bdfc619f8b71c131d17daa5713 to your computer and use it in GitHub Desktop.
Save laixintao/f86f63bdfc619f8b71c131d17daa5713 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
在命令行将javascript timestamp转换成人类可读的时间
Usage:
jstp 1506589075352
2017-09-28 16:57:55 +0800
"""
from __future__ import unicode_literals, division
import sys
import time
if __name__ == '__main__':
timestamp = int(sys.argv[1]) / 1000 # js
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