Skip to content

Instantly share code, notes, and snippets.

View ponggung's full-sized avatar

WPK ponggung

  • CCU
  • Taipei
View GitHub Profile
@DeronW
DeronW / time.py
Last active October 25, 2017 15:59
python 拿当前的时间戳 秒数和毫秒数,time的经度跟系统相关,windows小数点后3位,linux后面6位
import time
from datetime import datetime, date
# 今天
datetime.datetime.today().date().isoformat()
# 通过日期对象生成时间戳
int(time.mktime(datetime.now().timetuple()))
# 通过时间戳生成日期对象,timestamp 的时间戳以秒为单位