class Solution: def Days(self,year,month,day): if (year%4==0 and year%100!=0) or year%400==0: monthlist=[0,31,29,31,30,31,30,31,31,30,31,30,31] else: monthlist=[0,31,28,31,30,31,30,31,31,30,31,30,31] years=year-1 days=years*365+years/4-years/100+years/400 for i in range(0,month): monthdays=monthdays+monthlist[i] days=days+monthdays+day return days def SubDays(year1,month1,day1,year2,month2,day2): days1=Days(year1,month1,day1) days2=Days(year2,month2,day2) subday=days1-days2 print subday
时间: 2024-10-13 02:57:10