From: Ron M Date: 2005-11-16T22:22:46+09:00 Subject: Re: Converting between Time and DateTime Daniel Schierbeck wrote: > Chris Pine wrote: > >> I *wish* Time and DateTime worked more like Fixnum and Bignum. > > What kind of change would you suggest? I'd like classes like DBI that use Time to (through some trick like integer->bignum) allow dates 200 years in the future. Today, that's not the case, and selecting fields representing a 200-year-lease throws an error when done through DBI. irb(main):028:0> dbh.select_all("select begin_date,end_date from leases") ArgumentError: time out of range from /usr/lib/ruby/site_ruby/1.8/dbi/sql.rb:60:in `gm' from /usr/lib/ruby/site_ruby/1.8/dbi/sql.rb:60:in `as_timestamp' from /usr/lib/ruby/site_ruby/1.8/DBD/Pg/Pg.rb:777:in `as_timestamp' # end date is in 2204. I'd like to see a Time with an out-of-range year automatically produce a 'BigTime' class in exactly the same way that an out of range integer produces a Bignum. Whether this is the same as DateTime or not doesn't matter much to me. Being able to use a realistic range of dates in DBI does.