python中的time模块和datetime模块

>>> import time
>>> time.time()
1511330865.656656
>>> time.localtime(time.time())
time.struct_time(tm_year=2017, tm_mon=11, tm_mday=22, tm_hour=14, tm_min=8, tm_sec=46, tm_wday=2, tm_yday=326, tm_isdst=0)
>>> time.strftime('%Y-%m-%d',time.localtime(time.time()))
'2017-11-22'
>>>

>>> import datetime
>>> print datetime.timedelta(days=1)
1 day, 0:00:00
>>> print datetime.date.today()
2017-11-22
>>>

上一篇:db2 怎么计算两个时间相差多少个月。如2015-10-10 和2014-1-12


下一篇:C编译: makefile基础