code.py
Python
x
12
12
1
from datetime import datetime
2
date_1 = '24/7/2021 11:13:08.230010'
3
date_2 = '24/7/2021 11:14:18.333338'
4
date_format_str = '%d/%m/%Y %H:%M:%S.%f'
5
start = datetime.strptime(date_1, date_format_str)
6
end = datetime.strptime(date_2, date_format_str)
7
# Get the interval between two datetimes as timedelta object
8
diff = end - start
9
# Get the interval in milliseconds
10
diff_in_milli_secs = diff.total_seconds() * 1000
11
print('Difference between two datetimes in milli seconds:')
12
print(diff_in_milli_secs)