#!/usr/bin/python
#_*_coding:utf-8_*_
#计算两个日期之间的天数year/month/day 1991/12/14~2017/5/10
import datetime
import time
def days(date):
date=date.split('/')
if len(date)!=3:
return False
else:
year=int(date[0])
month=int(date[1])
day=int(date[2])
return year,month,day
#输入两个时间计算相差多少天
def be_days(date0,date1):
days1=datetime.date(days(date0)[0],days(date0)[1],days(date0)[2])
days2=datetime.date(days(date1)[0],days(date1)[1],days(date1)[2])
return abs(days2-days1)
date0=raw_input('please input a little date:\n>')
date1=raw_input('please input a big date:\n>')
print be_days(date0,date1)
'''
#输入时间计算至今多少天
def be_days(date0):
days1=datetime.date(days(date0)[0],days(date0)[1],days(date0)[2])
days2=datetime.date.today()
return abs(days2-days1)
date0=raw_input('please input a date:\n>')
print be_days(date0)
'''
网友评论