From: Elliot Temple Date: 2006-08-30T08:03:22+09:00 Subject: Re: Comparing Dates On Aug 29, 2006, at 3:53 PM, Parv G. wrote: > Hi, > This might be simple question for some you so. > > I'm trying to compare today's dates with another date, which is in the > format of mm/dd/yy. Can somebody help? > > I tried the following, but it doesn't work: > require 'date' > > if(Date.today <=> "09/29/06") or (Date.today <=> "092906") > ..... > else > .... > end Your code compares a date and a string. Try comparing two dates. If you don't know how to make a new date, try google or http://www.rubycentral.com/book/ BTW <=> is probably not what you want to compare with. It always returns a number, and numbers are true, so your if statement doesn't make much sense. irb(main):010:0> 1 <=> 2 => -1 irb(main):011:0> 1 <=> 0 => 1 irb(main):012:0> 1 <=> 1 => 0 irb(main):013:0> -- Elliot Temple http://www.curi.us/blog/