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 trialJohn Grillo
30,241 PointsSTRFTIME Task challenge
I'm doing the SQL reporting challenge and seem to be stuck on it. I've definitely done this before in my job, but for some reason I'm having a hard time with it. The challenge says that I'm formatting it to the correct time but after checking the SQL, MySQL and SQLite documentation, I can't seem to see what it is that I'm not getting.
Anyway, would appreciate a spot of advice.
SELECT
title
, STRFTIME("%M%Y", date_released) AS 'month_year_released'
FROM movies
3 Answers
jcorum
71,830 PointsJohn, you're very close. It makes a difference whether you use m or M. This works fine:
SELECT title, STRFTIME("%m/%Y", date_released) AS 'month_year_released' FROM movies
Fuzzyclaws Frostpaw
5,178 Pointshttp://php.net/strftime in the format parameters, it explains: %y Two digit representation of the year Example: 09 for 2009, 79 for 1979 %Y Four digit representation for the year Example: 2038
Evan Xu
2,172 PointsThat's interesting. Why It doesn't matter if we use y instead of Y?
John Grillo
30,241 PointsJohn Grillo
30,241 PointsWait, let me check that... Well i'll be dipped! Class case of the off-by-one error. Or more appropriately...it's other 'm'!
I know, I know...it was obligatory.
Help ref. for SQLITE as per the video in question. BTW, the big M is for 'Minutes', not 'months'.