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

Publié le: 07 novembre 2022
sur la chaîne: 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


Sur cette page du site, vous pouvez voir la vidéo en ligne Calculate Time Difference in Milliseconds Between Two datetimes in Python | Apply datetime Module durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Statistics Globe 07 novembre 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 873 fois et il a aimé 8 téléspectateurs. Bon visionnage!