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

  • SEARCH
  • Home
  • 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 7763933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:47:05+00:00 2026-06-01T14:47:05+00:00

I ran into this issue while testing a rails app deployed to two different

  • 0

I ran into this issue while testing a rails app deployed to two different staging servers, in different time zones (PDT and CDT). Both servers have rails using the default UTC config.time_zone. Apart from the timezone configuration being different, both servers have their clocks set correctly.

Below is what I see in a rails console:

On the server where system timezone is CDT,

Time.zone.parse("Mon May 28 2012 00:00:00 GMT-0700 (PDT)")
 => Mon, 28 May 2012 05:00:00 UTC +00:00 

On the server where system timezone is PDT,

Time.zone.parse("Mon May 28 2012 00:00:00 GMT-0700 (PDT)")
 => Mon, 28 May 2012 07:00:00 UTC +00:00

The string Mon May 28 2012 00:00:00 GMT-0700 (PDT) is an arbitrary date-time value sent by a client. This is a common scenario when using a javascript Date object coming in via the rails params collection.

Why are the two results Time.zone.parse(identical_date_time_string) different?

If I run the following on both systems, the result appears correct:

"Mon May 28 2012 00:00:00 GMT-0700 (PDT)".to_time
 => 2012-05-28 07:00:00 UTC

I’m running rails 3.2.3 with ruby 1.9.3-p125, on ubuntu.

  • 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-06-01T14:47:06+00:00Added an answer on June 1, 2026 at 2:47 pm

    ActiveSupportTimeZone.parse makes no attempt to extract the time zone information out of the given string. It simply extracts the date and time and converts it to a TimeWithZone with the given (local) time zone.

    str.to_time will take notice of the “GMT-0700” line, but will produce a time without a time zone.

    You could fudge it by extracting the “GMT…..” part and converting that to a UTC offset, which is close to, but not exactly, the time zone.

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

Sidebar

Related Questions

I ran into this issue on accident while debugging a faulty string trim function
Yesterday I ran into an Issue while developing a Web Part (This question is
This morning I ran into an issue with returning back a text string as
Ran into this error message while trying to select some records off a table.
I ran into this today when unit testing a generic dictionary. System.Collections.Generic.Dictionary<int, string> actual,
I ran into this situation today. I have an object which I'm testing for
I ran into a interesting issue today. Check out this pseudo-code: void Loop() {
A co-worker ran into an interesting issue today, and while I think the actual,
While writing a game for J2ME we ran into an issue using java.lang.Integer.parseInt() We
I ran into an issue today where my app was failing to start in

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.