Ryan Davis wrote: > On Mar 11, 2007, at 6:02 PM, Aaron Smith wrote: > >> I don't see any obvious ways of making a new Date object based off of >> what Time.now rerurns. I'm ultimately trying to make a new Date from >> milliseconds: >> >> tn = Time.now >> ms = ("%.6f" % tn.to_f) #this would ultimately be comming from another >> source >> nd = Time.at( ms.to_f / 1000.0 ) >> puts nd.to_a.inspect > > Remember, ri is your friend. > > % ri Date::civil > ------------------------------------------------------------ Date::civil > Date::civil(y=-4712, m=1, d=1, sg=ITALY) require 'date' ms = 1173658884500.0 nd = Time.at( ms.to_f / 1000.0 ) #puts nd #puts nd.to_a.inspect f = nd.to_a n = Date.parse("#{f[4]}-#{f[3]}-#{f[5]} #{f[1]}:#{f[2]}:#{f[3]} #{f[9]}") #puts n #puts n.class -- Posted via http://www.ruby-forum.com/.