From: Pit Capitain Date: 2006-03-15T22:06:25+09:00 Subject: Re: Time object problems - 1.8.2 Greg Lorriman schrieb: > I am trying to efficiently get the date part of a Time object. > > To remove the time part of the Time object I subtract the modulo of a > day-in-seconds. But if I do this I get a Time object of the date *plus > 1 hour*!!! Perhaps I'm just tired, but I don;t understand why. > > DAY_IN_SECS=60*60*24; > t=Time.parse("20-Oct-2005 04:04:00") > datePart=t-t.to_f.modulo(DAY_IN_SECS); > > (and I might apply Time.at to get a Time object rather than a float.) > > However, the result of the above is > > 20-Oct-2005 01:00:00 > > instead of > > 20-Oct-2005 00:00:00 > > Anyone got any ideas? Greg, look at this: p Time.at(0) It starts at 1 o'clock. Regards, Pit