TechTalk

python Datetime与时间戳转换

字数统计: 33阅读时长: 1 min
2019/02/26

时间到timestamp转换

1
2
3
from datetime import datetime
d = datetime(2019,02,25)
timestamp = datetime.timestamp(d)

timestamp到时间格式的转换

1
2
3
4
from datetime import datetime
timestamp = 1545730073
dt_object = datetime.fromtimestamp(timestamp)

CATALOG
  1. 1. 时间到timestamp转换
  2. 2. timestamp到时间格式的转换