def CompareDates self left_arg right_arg Сравнить даты левая правой tr

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
def CompareDates(self,left_arg,right_arg):
"Сравнить даты, левая с правой"
try:
LeftDate=time.mktime(time.strptime(left_arg,"%d.%m.%Y"))
RightDate=time.mktime(time.strptime(right_arg,"%d.%m.%Y"))
except:
raise ServDBError("dbserv: date format error")
#
if LeftDate==RightDate:
return 0
elif LeftDate<RightDate:
return 1
else:
return -1