Skip to content

Instantly share code, notes, and snippets.

@dtoma
Created December 12, 2013 13:16
Show Gist options
  • Save dtoma/7927794 to your computer and use it in GitHub Desktop.
Save dtoma/7927794 to your computer and use it in GitHub Desktop.
Ruby - Get number of days in a month
require 'date'
def days_in_month(year, month)
Date.new(year, month, -1).day
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment