From: Hassan Schroeder Date: 2011-09-16T00:48:43+09:00 Subject: Re: calculating days to go using date class-help needed On Thu, Sep 15, 2011 at 8:16 AM, joe c. wrote: > require 'date' #today = DateTime.now DateTime.now.to_date > birthday = Date.new(2011, 10, 10) # days_to_go = today-birthday days_to_go = birthday - today # the future is built with bigger numbers :-) > puts "Days to go: "+days_to_go.to_s > > It prints a number like -52632699/21600000 puts days_to_go.class #=> Rational > How do I get it to show true number of days, i.e. a number like 25 puts "Days to go: #{days_to_go.to_i}" HTH, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan