I have a simple question today. I want to get the difference between the 2 dates and check if the difference is around ~5 minutes.
And I found a problem with getting the difference, to check.
I compared the same date with one that had a few minutes difference, and it printed a difference of -1 day? That doesn't make sense to me.
Test it yourself, if you want.
Compared Dates:
Date1: 2021-05-15 00:38:57.244000
Date2: 2021-05-15 02:40:42.245693
The printed difference was:
Diff: -1 day, 21:58:14.998307
So why is it at -1 day? Shouldn't the difference be just ~2 hours? And what's the best way to get the difference between the 2 dates? As I said, I want to check if the difference is smaller (or equal to) 5 minutes. How is that possible if the dates can be every time different?
Important info: The dates are always different because I check account creation dates.
I used this code to make the difference:
diff = date1 - date2