def time_diff(close_time_str, open_time_str):
"""计算关闭时间与打开时间的时间差"""
if close_time_str == '':
return None
ct_date = datetime.datetime.strptime(close_time_str, '%Y-%m-%d %H:%M:%S')
ot_date = datetime.datetime.strptime(open_time_str, '%Y-%m-%d %H:%M:%S')
minutes = (ct_date-ot_date).seconds/60
return round(minutes, 2)
网友评论