0

I have two datetime objects <class 'datetime.datetime'>

d1 = 2022-04-25 08:27:36
d2 = 2022-01-28 20:41:57

What is the best way to get the number of days between these two dates in python?

SAB
  • 23
  • 5

1 Answers1

0

You can simply use this function(if you're using YY-MM-DD):

def numOfDays(date1, date2):
    return (date2-date1).days
Ilai K
  • 126
  • 4