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 trialSobin Sebastian
5,348 PointsI don't get it, whats wrong ?
In a movies database we have a movies table. It has the columns of id, title, date_released and genre. Write a query that returns the title first and the month and year it was released alias as month_year_released. Dates should look like "04/1983" for April 1983.
my answer is SELECT title, STRFTIME("m%/%Y") AS month_year_released FROM movies; Its saying Bummer! You may have got your params the wrong way around. https://teamtreehouse.com/library/reporting-with-sql/date-and-time-functions/formatting-dates-and-times
7 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Sobin,
Matthew is correct about that syntax error, and you're on the right track but are forgetting to included the data for the dates. Remember, when using STRTIME, you need to include the (<date format>, <time string>, optional modifiers). You have the date format but missing the time string.
Corrected code to include missing value:
SELECT title, STRFTIME("%m/%Y", date_released) AS month_year_released FROM movies;
Hope that helps.
Matthew Bilz
15,829 PointsTry moving the percent sign on your m parameter - STRFTIME("%m/%Y", date_released) perhaps
Samuel Corrado
1,256 Pointsok so i get the gist of this question, but can someone tell me why the month perimeter needs to be lower case while the year is uppercase. i can just tell that's going to mess me up in the future if i don't know the reasoning
Victoria Duan
5,860 PointsI was also wondering if the "Y" has to always be capitalized?
Yusmin Candra Tjantono
1,984 Pointsi also got this error Bummer! You may have got your params the wrong way around. SELECT title, STRFTIME("%m/%Y", date_released) AS month_year_released FROM movies;
dunno why the month and year table is empty. any one can help me? thanks
Aya khaled
Courses Plus Student 1,967 PointsSELECT title,STRFTIME("%m/%y",date_released) AS month_year_released FROM movies; i get this Bummer: You may have got your params the wrong way around.
Aya khaled
Courses Plus Student 1,967 PointsSELECT title,STRFTIME("%m/%Y",date_released) AS month_year_released FROM movies; this work correctly
Indhira Acevedo
1,894 Pointsso i in reality what i was getting wrong was the fact that i didnt put %y in caps %Y. So i thought i was wrong in other areas perhaps the order i was writing it until I came here and saw. SO im guessing this format is key sensitive? and is it only the year that has to be in caps? it wasnt on the lesson so i like to understand well before i take it for what it is