반응형
시간계산
-
python 시간 계산Programming/Python 2022. 4. 20. 15:27
start_dt = '2022-04-20 00:05:34' end_dt = '2022-04-20 12:19:17' from datetime import datetime def get_seconds(start_dt,end_dt,fm='%Y-%m-%d %H:%M:%S'): time_1 = datetime.strptime(start_dt,fm) time_2 = datetime.strptime(end_dt,fm) return (time_2 - time_1).seconds get_seconds(start_dt,end_dt) Result: 44023