Home > Net >  How to avoid python to return " days" when substracting 2 date?
How to avoid python to return " days" when substracting 2 date?

Time:11-04

Doing

self.StartDate       = pd.to_datetime("30/06/2021")
self.EndDate         = pd.to_datetime("30/09/2021")
test = self.EndDate - self.StartDate

returns test :

92 days 00:00:00

How can I just get 92 ?

CodePudding user response:

Try using the attribute .days

StartDate       = pd.to_datetime("30/06/2021")
EndDate         = pd.to_datetime("30/09/2021")
test = (EndDate - StartDate).days
  • Related