代码如下:
result = False
if record.date_from and record.date_to:
diff_days = (datetime.datetime.strptime(record.date_to,'%Y-%m-%d') - datetime.datetime.strptime(record.date_from,'%Y-%m-%d')).days
if diff_days>2:
result = True
代码如下:
result = False
if record.date_from and record.date_to:
diff_days = (datetime.datetime.strptime(record.date_to,'%Y-%m-%d') - datetime.datetime.strptime(record.date_from,'%Y-%m-%d')).days
if diff_days>2:
result = True