With a one-line function you can retrieve the number of days in a given month. Month must be passed as a number (1 to 12.)
Contextual Ads
More Ruby Resources
Advertisement
- def DaysIn(MonthNum)
- (Date.new(Time.now.year,12,31).to_date<<(12-MonthNum)).day
- end