Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6187547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:04:38+00:00 2026-05-24T02:04:38+00:00

I am upgrading the ruby version from ruby 1.8.7 to ruby 1.9.2 in my

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:04:39+00:00Added an answer on May 24, 2026 at 2:04 am

    you can use

    Time.now.asctime
    

    in 1.9

    EDIT 1:

    well, depends on how you’re going to use it. This should probably work for you:

    irb(main):001:0> class Time
    irb(main):002:1> class << self
    irb(main):003:2>   alias :orig_now :now
    irb(main):004:2>
    irb(main):005:2*   def now
    irb(main):006:3>     orig_now.asctime
    irb(main):007:3>   end
    irb(main):008:2> end
    irb(main):009:1> end
    => nil
    irb(main):010:0> Time.now
    => "Thu Jul 28 12:29:08 2011"  # STRING
    irb(main):011:0>
    

    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:

    irb(main):011:0> class Time
    irb(main):012:1>
    irb(main):013:1* def inspect
    irb(main):014:2>   self.asctime
    irb(main):015:2> end
    irb(main):016:1> end
    => nil
    irb(main):017:0> Time.now
    => Thu Jul 28 13:41:16 2011   # TIME
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given: A rails 2.3.x application currently being upgraded to rails 3. Upgrading ruby from
I have an application I am upgrading to 3.1 from Rails 3.0.9. But, I
How hard/complex would upgrading an application from Rails 2.2.2 to the latest build? I
As I am using Ruby on Rails to build an application, which only runs
in upgrading rails app from 2.2.2 to 2.3.9 first error was: D:\web>ruby script/server -trace
When upgrading from Ruby 1.8.6 to Ruby Enterprise 1.8.7 p334, the memory size has
After upgrading RubyGems to 1.8.7 from a much older version our Rails 2 apps
I'm attempting to use Mongoid from a plain Ruby script (not via Rails or
We are currently in the process of upgrading our rails version and I have
I am in the process of building a rails/flex application which requires audio to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.