From: Andrea Campagna Date: 2007-07-17T01:06:01+09:00 Subject: convert to time value Hi to all, i've a timestamp value stored in a Postgres DB. I've to make the difference between the time value obtained with Time.now function and the time value that get from the DB. The code is above: res = conn.query("SELECT stato,last_access FROM usage WHERE peer=100;") time=Time.new access_time=res[0][1] time=time - access_time When i try to run the script i get the following error: in `-': no implicit conversion to float from string (TypeError) i've tried to make a casting like this time=time.to_s - access_time.to_s but i get another error undefined method `-' for "Mon Jul 16 18:02:17 +0200 2007":String (NoMethodError) How can i cast the field??? thanks in advance!! -- Posted via http://www.ruby-forum.com/.