Python俱乐部
Python
小课题
京东优惠券
#!/usr/bin/env python #coding:utf-8 import datetime #一般的时间计算 d1 = datetime.datetime(2008, 10, 05,15,50) d2 = datetime.datetime(2008, 10, 03,21,9,0,0) d3 = datetime.timedelta(microseconds=5000) print (d1-d2).microseconds print (d1-d2).seconds print (d1-d2).days print d3 #时区转换,当前系统所在时区+1 d = datetime.datetime.now() d = d + datetime.timedelta(seconds=3600) print d print d.ctime()