I am upgrading the ruby version from ruby 1.8.7 to ruby 1.9.2 in my exiting Ruby on rails application which has extensive use of Time related calculations. But after switching to ruby 1.9.2 -p290 its not working. I guess the issue is with
$ rvm use 1.8.7
ruby-1.8.7-p334 :001 > Time.now
=> Thu May 12 12:42:35 +0200 2011
$ rvm use 1.9.2
ruby-1.9.2-p180 :001 > Time.now
=> 2011-05-12 12:42:44 +0200
Can some please tell me how to solve this kind of issue or How can change or override default ruby 1.9.2 format back to the old one or how to solve this time related changes in the newer version of ruby.
Thanks
you can use
in 1.9
EDIT 1:
well, depends on how you’re going to use it. This should probably work for you:
EDIT 2:
Ok, I got your question somewhat wrong. The above patch will cause Time.now to return the string (not the Time object).
If you just want to see Time object to be represented different you could apply this: