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! While you're at it, check out some resources Treehouse students have shared here.

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.

Start your free trial

Python Dates and Times in Python (2014) Let's Build a Timed Quiz App Simple Time Machine

Why is this not working?

I didn't understand what treehouse what telling me to do but i thought this could work, but it didn't

time_machine.py
import datetime

starter = datetime.datetime(2015, 10, 21, 16, 29)

def delorean(intege):
    return datetime.datetime.combine(starter + intege)

2 Answers

The combine method typically looks like this

def time_tango (some_date, some_time): return datetime.datetime.combine(some_date,some_time)

my_date= datetime.datetime.date(datetime.datetime.now()) my_time = datetime.datetime.time(datetime.datetime.now()) print(time_tango(my_date,my_time))

check it out ... and if this answers your question, please mark the question as answered.

You shouldn't be using combine, but instead be adding a timedelta based on the integer to the starter.

i.e.

return starter + datetime.timedelta( ... )

Keep in mind that the timedelta takes a number of days, not hours, so you'll need to adjust integer by a particular amount when passing it to the timedelta method.