experimenting with datetimes

This commit is contained in:
Mikayla Dobson
2022-04-06 12:53:27 -05:00
parent 1880b60602
commit bb2807e5fe
6 changed files with 52 additions and 20 deletions

23
datetime_test.py Normal file
View File

@@ -0,0 +1,23 @@
from datetime import datetime
from time import time
timestamp1 = "Feb 12 08:02:32 2014"
timestamp2 = "Feb 21 11:52:02 2014"
converted1 = datetime.strptime(timestamp1, "%b %d %H:%M:%S %Y")
converted2 = datetime.strptime(timestamp2, "%b %d %H:%M:%S %Y")
print(converted1)
print(converted2)
difference = converted2 - converted1
days_extracted = difference.days
print(difference)
def days_to_minutes(days):
hours = days * 24
minutes = hours * 60
return minutes
print(days_to_minutes(days_extracted))