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

Nicolás Avendaño Chung
Nicolás Avendaño Chung
3,413 Points

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.