From: Rick DeNatale Date: 2008-09-14T22:45:37+09:00 Subject: Re: Getting current date ------=_Part_88497_14765877.1221400361428 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, Sep 12, 2008 at 3:02 PM, Lloyd Linklater wrote: > I put the testing code in and I feel REALLY stupid. If it is still > wrong, I am going to hide under a rock until everyone forgets that I did > this. > > n = Time.now > if n.month == 1 > d = Time.gm(n.year - 1, 12, n.day) > else > d = Time.gm(n.year, n.month - 1, n.day) > end > This also doesn't handle edge cases like March 30/31, or October 31. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ ------=_Part_88497_14765877.1221400361428--