ca5
3/6/2014 - 5:40 AM

date sample

date sample

import datetime
today = datetime.datetime(2014,1,1) #2014/1/1
yesterday = today - datetime.timedelta(1) #2014/12/31
yesterday.year #2014
yesterday.month #12
yesterday.day #31

#timedelta
datetime.timedelta(1) #1日分 
datetime.timedelta(hours=1) #1時間分