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?

1
  • 1
    (d1 - d2).days? Commented Jan 28, 2022 at 11:56

1 Answer 1

0

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

def numOfDays(date1, date2):
    return (date2-date1).days
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.