botp
6/11/2009 2:12:00 AM
On Thu, Jun 11, 2009 at 9:19 AM, Xeno Campanoli<xeno.campanoli@gmail.com> w=
rote:
> 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 (attributio=
ns
> to kelyar, jgwong, and timmorgan, whoever they are):
>
> #!/usr/bin/ruby
> #
>
> require 'date'
>
> d0 =3D Date.new(2009,6,1)
> puts "trace d0: =A0#{d0}"
you could jump to end by using negative day
> d0 =3D Date.new(2009,12,-1)
=3D> #<Date: 2009-12-31 (4910393/2,0,2299161)>
> d0.day
=3D> 31