# 计算两个时间的时间差 def get_time_seconds(start_time, end_time): datetime.datetime.now().strptime(str(start_time), "%Y-%m-%d %H:%M:%S.%f") # start_end_time_seconds = (end_time - start_time).seconds # 时间差的计算,单位为秒,超过一天计算出来不对 start_end_time_seconds = (end_time - start_time).total_seconds() # 时间差的计算,单位为秒,这个是正确的计算方法 return int(start_end_time_seconds)
python 计算两个时间相差的秒数,超过一天时计算出来的秒数不对
最新推荐文章于 2024-07-11 10:51:26 发布