Vote count:
0
I've been using the datetime module to create datetime objects from two input strings.
I'm trying to simply calculate the time difference between 1:00 PM and 10:00 AM, which should be 3 hours, not 15 hours, as I'm getting below.
What am I doing wrong?
In [29]: time1 = datetime.datetime.strptime('10:00AM', '%H:%M%p')
In [30]: time2 = datetime.datetime.strptime('1:00PM', '%H:%M%p')
In [31]: print time2 - time1
-1 day, 15:00:00
Thank You
asked 24 secs ago
Why is Python's datetime difference returning the the wrong value?
Aucun commentaire:
Enregistrer un commentaire