On 6/15/07, Mecharek Massinissa
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> hello,
>
> i have to dates :
>
> @date_1 = date.new()
>
> @date_2 = date.new()
>
> i want to compare theses two dates
>
> i have tried
>
> @date_1 > @ date_2 but every time it returns me FALSE
>
>
> is there a solution .?????
>
> thanks
This is returning false because the same date is returned by a call to
Date.new which defaults to 0. ( Mon, 01 Jan -4712 )
Instead you could use
Date.today > ( Date.today - 1 ) # => true
Date.civil( 2007, 12, 31 ) > Date.civil( 2007, 12, 30 ) # => true
Hope that helps.
Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---