python 日期加減與轉換爲str

from datetime import datetime, timedeltaspa

now_time = datetime.now()  # datetime.datetime(2015, 10, 22, 16, 56, 51, 924895)it

 str_now = str(now_time).split('.')[0]ast

date_last_time = datetime.strptime(last_pull_time,'%Y-%m-%d %H:%M:%S')import


datetime轉time時間戳:date

time.mktime(order[4].timetuple())im


>>> import datetime
>>> d1 = datetime.datetime(2005, 2, 16)
>>> d2 = datetime.datetime(2004, 12, 31)
>>> (d1 – d2).days
47時間戳

now_time -d2datetime

相關文章
相關標籤/搜索