from datetime import datetime
datetime.now() #当前时间
datetime.now.strftime('%Y-%m-%d %H:%M:%S')
from datetime import datetime
t2 = datetime.now()
t1 = datetime.now()
(t2-t1).seconds/days
#datetime(中可以使用具体的时间) eg: datetime(2004, 12, 31)
d1 = datetime.now()
d2 = d1 + datetime.timedellta(hours=10) # 这个 datetime是库
d2.ctime()
import datetime
import time
str1 = '2021-04-15 15:00:00'
time1 = time.mktime(time.strptime(str1, '%Y-%m-%d %H:%M:%S'))
time1 = datetime.datetime.fromtimestamp(time1)
import time
int(time.time()) #距离1970年的秒数
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(x)) # x可以为指定的时间戳:os.path.getctime(file)