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 trial

Databases

help needed

https://teamtreehouse.com/library/reporting-with-sql/date-and-time-functions/formatting-dates-and-times

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.

select title, strftime ("%m/%y") as month_year_released from movies

2 Answers

Steven Parker
Steven Parker
231,248 Points

It looks like you forgot to tell strftime which column to format

After the format string itself, you need a second argument (separate by a comma) with the name of the column to be processed.

Also, for a 4-digit year, the format should have a capital "Y"

Alix Chang
Alix Chang
2,741 Points

SELECT title, STRFTIME("%m/%Y", date_released) AS month_year_released FROM movies;

This should be right. It looks like you forgot to put <time string> after the <date string>.