Using DateSerial, you can get the number of days in the monthly day.
Day (DateSerial (YYYY, MM 1, 0))
As February 2004, YYYY = 2004, MM = 2 gets 29