Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

jp28
3,413 PointsWhy 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
import datetime
starter = datetime.datetime(2015, 10, 21, 16, 29)
def delorean(intege):
return datetime.datetime.combine(starter + intege)
2 Answers

markmneimneh
14,132 PointsThe 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.

Iain Simmons
Treehouse Moderator 32,289 PointsYou 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.