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 Reporting with SQL Date and Time Functions Formatting Dates and Times

What am I missing?

Says my formatting for the date is wrong but returns the exact same thing I did.

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

1 Answer

Hi Brian!

Really pay attention to the instruction (step-by-step).

"Write a query that returns the title first":

SELECT title

"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;

(Of course, you need to get the month/year info from date_released, not title!?!)

This question/answer is probably overkill, but might help you in the long run with SQL in general:

https://teamtreehouse.com/community/how-to-remember-where-to-put-what-part-of-a-sql-query

I hope that helps.

Stay safe and happy coding!

Thank you!