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 trialDeborah Watson
2,614 PointsSTRFTIME() Bummer: You may have got your params the wrong way around.
What am I missing here?
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.
SELECT title, STRFTIME("%m,%y", date_released) AS month_year_released FROM movies;
3 Answers
Steven Parker
231,172 PointsThat message might be a bit confusing, but the instructions say, 'Dates should look like "04/1983"'.
The template shown in the query above has a comma instead of a slash for a separator, and "%y" instead of "%Y" for the year token.
Deborah Watson
2,614 PointsSteven, I removed the first "date_released". I'm not sure what you mean by "fix the template token for the year"
I tried this: SELECT title,STRFTIME("mm/yyyy", date_released) AS month_year_released FROM movies;
And got this: Bummer: Your query retrieve the dates in the correct format
Steven Parker
231,172 PointsIn my original answer, I pointed out two problems in your format template:
- a comma instead of a slash, and
- "%y" instead of "%Y" for the year token.
So, instead of "%m,%y" the template should be "%m/%Y"
Deborah Watson
2,614 PointsThank you! I was researching https://www.sqlite.org/lang_datefunc.html just as you posted this.
Deborah Watson
2,614 PointsDeborah Watson
2,614 PointsI removed the comma and added date_released and got this: Bummer: Your query retrieve the dates in the correct format (%m/%Y). SELECT title, date_released,STRFTIME("%m/%y",date_released) AS month_year_released FROM movies;
Steven Parker
231,172 PointsSteven Parker
231,172 PointsYou already have a formatted "date_released", why add another one unformatted?
Also, you still need to fix the template token for the year.