Calculate Time Difference in Milliseconds Between Two datetimes in Python | Apply datetime Module

Опубликовано: 07 Ноябрь 2022
на канале: Statistics Globe
873
8

How to return the time difference between two datetimes in milliseconds in the Python programming language. More details: https://statisticsglobe.com/calculate...
Python code of this video (the code was created by Matthias Bäuerlen):

import datetime # Import datetime module

my_date_1 = datetime.datetime(2022, 5, 24, 11, 20, 12, 987123) # Create first example datetime object
print(my_date_1)

my_date_2 = datetime.datetime(2022, 6, 16, 13, 30, 27, 189553) # Create second example datetime object
print(my_date_2)

my_diff_default = my_date_2 - my_date_1 # Get default time difference
print(my_diff_default)

my_diff_milli_sec = my_diff_default.total_seconds() * 1000 # Return difference in milliseconds
print(my_diff_milli_sec)

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  

Music by bensound.com


На этой странице сайта вы можете посмотреть видео онлайн Calculate Time Difference in Milliseconds Between Two datetimes in Python | Apply datetime Module длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Statistics Globe 07 Ноябрь 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 873 раз и оно понравилось 8 зрителям. Приятного просмотра!