Austin Ziegler wrote: > On 9/20/06, Yu Co <djhackebeil / yahoo.de> wrote: >> Hi all, >> >> I have the following peace of code: >> arr = [5, 5, 2002] >> date = Date.new(arr[2].to_i, arr[1].to_i, arr[0].to_i) >> >> I need to convert the String elements in the array into int. I want to >> do that with to_i, but this method returns me a Fixnum, thus I couldn't >> fill my date Object... >> Any suggestions? > > Yes. Try it again. > > 1. Your array contains Fixnum values already. > 2. You're probably getting a different error. > 3. Fixnum values are integer values. > > If you have a problem, your real code and/or a backtrace would be > useful. > > -austin The error message looks like {RUBY_HOME}/lib/ruby/1.8/date.rb:591:in `new': invalid date (ArgumentError) from {}db/old_DB.rb:98:in `parseToDate' from {}db/old_DB.rb:61:in `callMethod' from {}db/old_DB.rb:47:in `callMethod' ... I am wondering why Ruby converts a String to Fixnum after calling to_i -- Posted via http://www.ruby-forum.com/.