Wes Gamble wrote: > Wes Gamble wrote: >> Wow - dates and times sure are all over the place in Ruby. >> >> I want to initialize a DateTime object to have MDY of 12/30/1899 but >> time components matching the current time. >> >> I've tried: >> >> DateTime.strptime("%Y-%m-%d %h:%M:%S", "1899-12-30 >> #{time.hour}:#{time.min}:#{time.sec}") >> >> but strptime doesn't seem to like it. >> >> Do I need to use a Time object - where's the correct string parsing >> method for me to use? >> >> Thanks, >> Wes > > Then I tried > > Time.local(1899,"dec",30,10,0,0) > > and 1899 is too far back. > > Is there any way that I can create a time object with arbitrary year, > month, and day and current hour, minute, and second? > > Thanks, > Wes This seems to get me pretty close. DateTime.civil(1899, 12, 30, time.hour, time.min, time.sec, DateTime.now.offset()) WG -- Posted via http://www.ruby-forum.com/.