# Comparing dates

**URL:** <https://www.ruby-forum.com/t/comparing-dates/158903>\
**Category:** Rails\
**Created:** [June 15, 2007, 11:15am UTC](https://www.ruby-forum.com/t/comparing-dates/158903 "2007-06-15T11:15:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![massi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b9e5f3/32.png) [@massi](https://www.ruby-forum.com/u/massi)\
**Post date:** [June 15, 2007, 11:15am UTC](https://www.ruby-forum.com/t/comparing-dates/158903/1 "2007-06-15T11:15:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![massi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b9e5f3/32.png) [@massi](https://www.ruby-forum.com/u/massi)\
**Post date:** [June 15, 2007, 12:44pm UTC](https://www.ruby-forum.com/t/comparing-dates/158903/2 "2007-06-15T12:44:24Z")

</div>

I am still new to all of this but it might be worth a try converting  
them to be integers first and then carryinag out the comparison

ie. something like time.now.to\_i

then comparing the integers

Hope that helps

On Jun 15, 10:15 am, Mecharek M. \<rails-mailing-l…@andreas-
