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 50763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:38:39+00:00 2026-05-10T16:38:39+00:00

I am working on a Rails application that needs to handle dates and times

  • 0

I am working on a Rails application that needs to handle dates and times in users’ time zones. We have recently migrated it to Rails 2.1 and added time zone support, but there are numerous situations in which we use Time#utc and then compare against that time. Wouldn’t that be the same as comparing against the original Time object?

When is it appropriate to use Time#utc in Rails 2.1? When is it inappropriate?

  • 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. 2026-05-10T16:38:40+00:00Added an answer on May 10, 2026 at 4:38 pm

    If you’ve set:

    config.time_zone = 'UTC' 

    In your environment.rb (it’s there by default), then times will automagically get converted into UTC when ActiveRecord stores them.

    Then if you set Time.zone (in a before_filter on application.rb is the usual place) to the user’s Time Zone, all the times will be automagically converted into the user’s timezone from the utc storage.

    Just be careful with Time.now.

    Also see:

    http://mad.ly/2008/04/09/rails-21-time-zone-support-an-overview/

    http://errtheblog.com/posts/49-a-zoned-defense – you can use the JS here to detect zones

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am thinking of working on a Rails application that uses PostgreSQL. I have
I'm working on a Rails 3.2 application that will allow users to authenticate with
Background Currently, I am working on a Rails application. I have different products that
I'm working on a backbone rails application that needs to poll the server to
I'm working on a Rails application that's kind of like a blog. Users create
I'm working on a Rails 3.1 application that needs to start up a couple
I am working on a Rails 3 application that needs to validate the password
I'm having working on a Rails application that is supposed to run on an
Started working on a new application this week that is running the latest rails
I'm working on rails application with postgres db.I have a table called merchant_review_votes where

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.