python 求两个时间差

    def timeInterval(self):
        today = datetime.date.today()
        print today
modifiedTime
= os.stat(filename).st_mtime//该文件的修改时间 modifiedTime = datetime.date.fromtimestamp(modifiedTime) //在这里转换年-月-日 格式 print modifiedTime
   dayCount
= (today - modifiedTime).days
     print dayCount

 

或者最简单的:

 start = time.time()
time_interval = time.time() - start

posted @ 2014-01-08 16:57  无脚的鸟  阅读(2336)  评论(0编辑  收藏  举报