From: Michael Guterl Date: 2006-10-09T22:45:57+09:00 Subject: Beginning of day given a Time value ------=_Part_44593_15758771.1160401553564 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Anyone have a nice idiomatic way given an instance of Time, to return the beginning of that day? Below is my approach but it just feels very wrong... require "test/unit" require "time" class Time def begin_of_day Time.parse "#{self.month}/#{self.day}/#{self.year}" end end class TestBeginOfDay < Test::Unit::TestCase def test_begin_of_day start_of_day = Time.parse "10/1/2006 00:00" time = Time.parse "10/1/2006 9:45" assert_equal(start_of_day, time.begin_of_day) end end Thanks, Michael Guterl ------=_Part_44593_15758771.1160401553564--