From: Nathan Clark Date: 2010-12-31T23:36:28+09:00 Subject: Re: change integer into date > require 'date' >  biaozun=Date.new(1970,1,1) >  puts biaozun+1262222200/86400 > =>2009-12-31 > i have change  1262222200 into date,2009-12-31 > 1.can i change  2009-12-31  into  1262222200? > 2.is there better way to change  1262222200 into date,2009-12-31 Methods for dealing with Unix times are in the Time class, rather than the Date class. irb> time = Time.at(1262222200) => 2009-12-30 20:16:40 -0500 irb> time.to_i => 1262222200 irb> time = Time.new(2010, 12, 31) => 2010-12-31 00:00:00 -0500 irb> time.to_i => 1293771600 Unfortunately, there doesn't seem to be any good way to convert from Date to Time, other than Time.new(date_object.to_s).