Seconds between two dates

How could I get the seconds between two dates ion Ruby?

I need the seconds remaining from the current date and a date in the
future.

date1: current date, for example 2009-01-09 17:00:00
date 2 : 2009-05-08 17:00:00

How could I get the seconds between these two dates?.

Thanks.

I think that the following works:

(Time.now-Time.gm(2009,"may",8,17,00,00)).to_i

blambeau

···

On Fri, Jan 9, 2009 at 12:29 PM, fReDiNi <freduchi@gmail.com> wrote:

How could I get the seconds between two dates ion Ruby?

I need the seconds remaining from the current date and a date in the
future.

date1: current date, for example 2009-01-09 17:00:00
date 2 : 2009-05-08 17:00:00

How could I get the seconds between these two dates?.

Thanks.

I think it's working but the operands need to be changed to get the
positive difference in seconds that I needed.

(Time.gm(2009,"may",8,17,00,00)-Time.now).to_i

thank you very much blambeau.

···

On 9 ene, 12:39, LAMBEAU Bernard <blamb...@gmail.com> wrote:

I think that the following works:

(Time.now-Time.gm(2009,"may",8,17,00,00)).to_i

blambeau

On Fri, Jan 9, 2009 at 12:29 PM, fReDiNi <fredu...@gmail.com> wrote:
> How could I get the seconds between two dates ion Ruby?

> I need the seconds remaining from the current date and a date in the
> future.

> date1: current date, for example 2009-01-09 17:00:00
> date 2 : 2009-05-08 17:00:00

> How could I get the seconds between these two dates?.

> Thanks.