## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today. # Stuck in Timedelta Minutes Challenge

Hello,

I know this is a relatively easy challenge, but with great shame, I feel stuck.

I tried this code on eclipse and I feel that this is what the task is wanting me to do. However, I keep getting Bummer! Try again!

I am uncertain what I am failing to comprehend. Either what the task wants me to do or an error in my code I am not seeing it!

minutes.py
```import datetime

def minutes(datetime1, datetime2):
datetime1 = datetime.timedelta.total_seconds(datetime1)
datetime2 = datetime.timedelta.total_seconds(datetime2)
difference_in_minutes = (datetime1 - datetime2) / 60
return round(difference_in_minutes)

datetime1 = datetime.timedelta(seconds = 10)
datetime2 = datetime.timedelta(seconds = 59)

minutes(datetime1, datetime2)
``` When we subtract the 2 dates, the result is a timedelta, so we only need to get the total_seconds from the resulting answer.

``` import datetime

def minutes(datetime1, datetime2):
difference_in_minutes = (datetime2 - datetime1)
return round(difference_in_minutes.total_seconds()/60)

datetime1 = datetime.datetime.now()
datetime2 = datetime.datetime.now() + datetime.timedelta(seconds=1000)
# print(datetime1)
print(minutes(datetime1, datetime2))
```

Hello,

Thank you for the response! I tried to write it this way

```import datetime

def minutes(datetime1, datetime2):
difference_in_minutes = (datetime1 - datetime2).timedelta.total_seconds() / 60
return round(difference_in_minutes)
```

and I got bummer try again.

When I tried it your way it worked!

So, I know the answer but I am still confused.

Why would it be wrong not to do timedelta.total_seconds() on the resulting answer. I honestly don't know the difference in doing timedelta.total_second() before doing the subtraction or doing it after subtraction. Aren't these two the same thing? The moment you subtract 2 datetime objects, the resulting object is a timedelta, So in you case the moment you do

```(date1-date2)
```

the result if a timedelta and the only methods or attributes available after that are those that apply to timedelta. Doing this

```(date1-date2).timedelta
```

will produce an error. so if you do this

```print(type(date2-date1))
```

```<class 'datetime.timedelta'>
```

To conclude you only need to do this in your program. Since datetime1 is older you should do this instead

```difference_in_minutes = (datetime2 - datetime1).total_seconds() / 60
```