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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:46:54+00:00 2026-05-23T02:46:54+00:00

This is pretty confusing for me. My MySQL database server stores times in SYSTEM,

  • 0

This is pretty confusing for me. My MySQL database server stores times in “SYSTEM”, which is PDT, as does my application server. But I can’t figure out how to make ActiveRecord interpret datetimes coming from my database as already being in PDT format. But if I set:

config.time_zone = "Pacific Time (US & Canada)"

then a database time value of:

2011-06-09 03:19:57

then in the Rails console I end up with:

Wed, 08 Jun 2011 20:19:57 PDT -07:00

It subtracted 7 hours! That tells me it is interpreting the incoming time as UTC instead of Pacific.

So how do I get Rails to interpret database dates in the right time zone?

  • 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-23T02:46:55+00:00Added an answer on May 23, 2026 at 2:46 am

    I found the answer. In environment.rb, I added:

    ActiveRecord::Base.default_timezone = :local
    

    For some reason, it was defaulting to :utc. The docs say it defaults to :utc, but my application wasn’t. Rails 3.0.8 FYI.

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

Sidebar

Related Questions

the question title seems pretty confusing, but this is what i want to achieve.
I find this pretty confusing. When you want to rotate a view, it's going
This is pretty trivial, but I noticed on SO that instead of an offset
The documentation is pretty confusing on this one: The implementation of accessor methods you
I'm having a pretty confusing problem in building a binary tree. Apparently this should
Looking at referencing in PHP is pretty much confusing me, can anyone explain to
Hey guys sorry this is a pretty long question but I cannot call printPASSInfo()
This is pretty confusing. I'm receiving this error whenever I try to add to
This pretty much has me defeated. On XP and earlier versions of Windows you
this pretty much is the thing. When in tinymce I press anything that is

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.