From: Rick DeNatale Date: 2009-03-18T22:07:29+09:00 Subject: Re: Convert from DateTIme to Time --00163628360ac425180465645253 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Wed, Mar 18, 2009 at 12:23 AM, Horacio Sanson wrote: > On Wed, Mar 18, 2009 at 7:46 AM, Guillaume Loader > wrote: > > Hello :) > > > > How can I convert from DateTIme to Time? > > > > require "date" > > class DateTime > def to_time > Time.mktime(year, month, day, hour, min, sec) > end > end > > > date = DateTime.now > time = date.to_time > time.class => Time > One little glitch. Time can only represent values through January 1, 2038, DateTime has a longer range. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale --00163628360ac425180465645253--