From: botp Date: 2009-06-11T11:12:15+09:00 Subject: Re: Is there a decent canonical way to get total days in a month from say Time class? On Thu, Jun 11, 2009 at 9:19 AM, Xeno Campanoli wrote: > Xeno Campanoli wrote: >> >> I suppose I could flip through local until I generate an exception, but >> somehow I would think there would be a set of class methods to get: > > Here's a fairly simple sequence I found on the net using Date (attributions > to kelyar, jgwong, and timmorgan, whoever they are): > > #!/usr/bin/ruby > # > > require 'date' > > d0 = Date.new(2009,6,1) > puts "trace d0:  #{d0}" you could jump to end by using negative day > d0 = Date.new(2009,12,-1) => # > d0.day => 31