app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import pandas as pd from datetime import datetime date_1 = '2/7/2021 21:55:12.230010' date_2 = '24/9/2023 11:13:08.333338' date_format_str = '%d/%m/%Y %H:%M:%S.%f' start = pd.to_datetime(date_1, format=date_format_str) end = pd.to_datetime(date_2, format=date_format_str) # Get the interval between two datetimes as timedelta object diff = end - start # Get the interval in milliseconds diff_in_milli_secs = diff.total_seconds() * 1000 print('Difference between two datetimes in milli seconds:') print(diff_in_milli_secs) |