SELECT date_format( '2007/05/10', '%Y-%m' )
put istead of date your date as below:
SELECT date_format( yourdate, '%Y-%m' )
Main Topics
Browse All TopicsHi,
This is very simple.
I use the following approach to get the last day of a month from a date:
>>select DAYOFMONTH(last_day('2004-
Thing is, I don't want to use a full date like 2004-02-01, instead I'd like to use a date format with only the year and month, like this : 2006-02.
But doing that gives me a 'Null' result.
Any idea how i can use only a year and month date format (2004-02) in the sql statement above?
Thanx
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: todd_farmerPosted on 2007-01-19 at 18:24:10ID: 18354060
You can't. If you're trying to make it match what your application is getting as input, just do:
('2004-02' , '-01')) as last_day;
select DAYOFMONTH(last_day(CONCAT