I am new to sql and programming so please bear with me. Is there a function in mysql that gets the number of days in a month? Example if the month is February and the year 2012 it should return 29. Thanks in advance.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no direct “last day of month”, but you can fake it by doing a day(last_day())
last_day()returns the full date of the last day in in the year/month of a specified date, so you then simply useday()to extract the day of that last_day.MySQL’s date/time functions documentation is here: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html