Possible Duplicate:
Get Last Day of the Month in Python
How can I get the number of days in the current month? I.e.,if the current month is “Jan 2012” I should get 31. If it is “Feb 2012” I should get 29.
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.
As Peter mentioned,
calendar.monthrange(year, month)returns weekday (0-6 ~ Mon-Sun) and number of days (28-31) foryear,month.Edit: updated answer to return the number of days of the current month