--nextPart1227098.0ikUsyLUI4
Content-Type: text/plain;
charset="iso-8859-15"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
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).
=20
How can I achieve this?
ex:
require 'parsedate'
sql_time =3D Time.mktime(*ParseDate.parsedate("2007-07-07"))
cur_time =3D Time.now
difference =3D cur_time - sql_time # result will be in seconds
Hope that helps.
=2D-=20
Konrad Meyer <
[email protected]>
http://konrad.sobertillnoon.com/
--nextPart1227098.0ikUsyLUI4
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
iD8DBQBGut1rCHB0oCiR2cwRAoWLAJ4p/QWe4M71ET7Qp8o/U464610eXgCgvtjI
74bcOxdt0Jnig1Vs4HTveNY=
=4e82
-----END PGP SIGNATURE-----
--nextPart1227098.0ikUsyLUI4--