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 trialY B
14,136 Pointsdatetime conversion works in interpreter but not challenge
Hmm this function seems to work in the interpreter but not the challenge although the challenge does also tell me the output is 15 October 2014 which is the format the question is looking for?
import datetime
def to_string(dt):
return dt.strftime('%d %B %Y')
6 Answers
Mikael Enarsson
7,056 PointsYou have accidentally added 2 whitespaces between '%d' and '%B'. Otherwise everything looks perfect!
Y B
14,136 PointsDon't worry, I didn't need the quotes round the string....
Mikael Enarsson
7,056 PointsGood job solving it ^^
Y B
14,136 Pointswow good spot! thank you.
Mikael Enarsson
7,056 PointsNo problem ^^
Y B
14,136 Pointsmm I seem to get an error in the second part too?
def from_string(stdate, form):
return datetime.datetime.strptime(stdate, 'form')
Y B
14,136 PointsThanks for the encouragement
Kenneth Love
Treehouse Guest TeacherThe worst programming errors are the little ones.