from datetime import *
# create a date( ) list
datetime_list=[date(2016,6,30),date(2016,6,31).............]
print(min(datetime_list),max(datetime_list))
delta_days=max(datetime_list)-min(datetime_list)
print(delta_days.days)
delta_days=date(2016,3,28)-date(2016,3,21)
print(delta_days.days)
#------------- check the date is what day of the week-----------------------------------------
dt=date(2016,3,20)
if dt.isoweekday()==6 or dt.isoweekday()==7:
print('do someting')
detail: https://docs.python.org/2/library/datetime.html
沒有留言:
張貼留言