Calculating the difference of to dates

I want to calculate the difference (days, hours, minutes)
between a given date out of a mysql database (2007-07-07, date) and
the current date (Time.now).

How can I achieve this?

Thanx

On Thursday 09 August 2007 01:29:46 am Jochen K. wrote:

I want to calculate the difference (days, hours, minutes)
between a given date out of a mysql database (2007-07-07, date) and
the current date (Time.now).

How can I achieve this?

ex:

require ‘parsedate’

sql_time = Time.mktime(*ParseDate.parsedate(“2007-07-07”))
cur_time = Time.now

difference = cur_time - sql_time # result will be in seconds

Hope that helps.