Riding The Breeze

Jump to content

Additional information

Categories


Posts filed in ‘Ruby’


Get last day of the month with Ruby

Feb 2007
08

last_day_of_the_month = (Date.parse(year_to_process + "-" + (month_to_process.to_i + 1).to_s + "-01") - 1).mday().to_s rescue "31"

The final rescue is due to catch the error when month_to_process is 12.


Paging

Credits

Template designed by praegnanz.de.