Skip to content

Instantly share code, notes, and snippets.

@samullen
Created April 30, 2010 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samullen/385241 to your computer and use it in GitHub Desktop.
Save samullen/385241 to your computer and use it in GitHub Desktop.
find the last day of the month
require 'date'
(Date.new(year, 12, 31) << (12-month)).day # Ruby 1.8.x
Date.new(2010, 12, 31).prev_month(12 - 4).day # Ruby 1.9.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment