Monday, September 7, 2009

php number of days in month

in my search for a method to get the number of days in a given month in php, i found one method from the php.net site. it uses the t variable in the date function. i tested it and it returned 31 days for the month of september. i found another method at the about.com site. i like it. this is how it works: $noOfDaysInMonth = cal_days_in_month(CAL_GREGORIAN, $monthIndex, $year) ; it takes the month index and the year and returns the number of days in that month.

No comments: