Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


STRFTIME function is not returning correct answer.

Question -

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.

Answer -

Select title, STRFTIME("%M/%Y", date_released) as month_year_released from movies;

This is not correct as per the teamtreehouse. The month column is returning 00 values for all the titles, year is coming correct.

Select Title, STRFTIME("%m/%Y", date_released) as month_year_released from movies;

Use small letter m for the month.

2 Answers

Kevin Gates
Kevin Gates
14,935 Points

Should look like this, with a lowercase m and an uppercase Y

SELECT title, STRFTIME('%m/%Y', date_released) as month_year_released
FROM movies;
Mohd Aamir Mir
Mohd Aamir Mir
3,281 Points

Kevin Gates thanks for the help...figured that out...Appreciate ur help...