1.计算日差值
d1 = datetime.date(2011,9,8)
d2 = datetime.date.today()
d = (d2-d1).days
add:http://zydest.iteye.com/blog/1286443
2.计算日期段:
d1 = datetime.datetime.now()
d2 = d1 + datetime.timedelta(100)
那这个d2就是100天后的日期啦~~
add:http://blog.sina.com.cn/s/blog_7407815a0101cggl.html
3.其他时间差
import datetime
starttime = datetime.datetime.now()
#long running
endtime = datetime.datetime.now()
print (endtime – starttime).seconds
add:http://www.cnblogs.com/SophiaTang/archive/2012/03/25/2417031.html
d1 = datetime.date(2011,9,8)
d2 = datetime.date.today()
d = (d2-d1).days
add:http://zydest.iteye.com/blog/1286443
2.计算日期段:
d1 = datetime.datetime.now()
d2 = d1 + datetime.timedelta(100)
那这个d2就是100天后的日期啦~~
add:http://blog.sina.com.cn/s/blog_7407815a0101cggl.html
3.其他时间差
import datetime
starttime = datetime.datetime.now()
#long running
endtime = datetime.datetime.now()
print (endtime – starttime).seconds
add:http://www.cnblogs.com/SophiaTang/archive/2012/03/25/2417031.html
没有评论:
发表评论