On Sun, Nov 11, 2012 at 10:04 AM, Ferdous ara <lists / ruby-forum.com> wrote:

> i have seen couple of example of convert the date to string. but dont
> understand how to use that in my example

Why would you want to? For your use case it's easier to compare
actual DateTime objects than strings.

Look at the docs for Date, DateTime and Time in the stdlib.

1.9.3 (main):0 > t2 = DateTime.new(2012, 11, 11, 9, 1, 2)
=> #<DateTime: 2012-11-11T09:01:02+00:00 ((2456243j,32462s,0n),+0s,2299161j)>
1.9.3 (main):0 > t1 = DateTime.new(2012, 11, 11, 9, 1, 1)
=> #<DateTime: 2012-11-11T09:01:01+00:00 ((2456243j,32461s,0n),+0s,2299161j)>
1.9.3 (main):0 > t2.to_time - t1.to_time
=> 1.0

-- 
Hassan Schroeder ------------------------ hassan.schroeder / gmail.com
http://about.me/hassanschroeder
twitter: @hassan