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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:40:41+00:00 2026-05-21T04:40:41+00:00

To start, I am using an old rails version because of Redmine. I am

  • 0

To start, I am using an old rails version because of Redmine.

I am trying to write a script for updating Redmine’s database dump timestamps’ to a specific timezone, therefore I need ruby to parse them and change the timezone, assuming rails can handle dst boundaries.

Nevertheless, I found an inconsistency in (or misunderstood) how Time.parse works.

Here’s the script I executed on my Rails 2.3.5 raw application:

impulse@ImpulseServer:~/pgtz_converter$ script/console
Loading development environment (Rails 2.3.5)
>> Time.zone
=> #<ActiveSupport::TimeZone:0x7fa94a57b9a8 @tzinfo=nil, @name="UTC", @utc_offset=0>
>> Time.parse('2011-02-19 23:00:00')
=> Sat Feb 19 23:00:00 -0200 2011
>> Time.zone
=> #<ActiveSupport::TimeZone:0x7fa94a57b9a8 @tzinfo=nil, @name="UTC", @utc_offset=0>
>> Time.parse('2011-02-20 00:00:00')
=> Sun Feb 20 00:00:00 -0300 2011
>> Time.zone
=> #<ActiveSupport::TimeZone:0x7fa94a57b9a8 @tzinfo=nil, @name="UTC", @utc_offset=0>
>> Time.parse('2011-02-19 23:00:00')
=> Sat Feb 19 23:00:00 -0300 2011
>> Time.zone
=> #<ActiveSupport::TimeZone:0x7fa94a57b9a8 @tzinfo=nil, @name="UTC", @utc_offset=0>
>> exit

Here’s what is going on above:

The server local datetime zone is BRT.

impulse@ImpulseServer:~/pgtz_converter$ date
Fri Apr  8 19:17:34 BRT 2011

First I check Time.zone (which is UTC), then try to parse a DST date.
The output is fine, DST is on (I presume Time.zone = UTC means Ruby checked the server zone configuration and used it).
Then I try another date, in which DST was not active anymore (DST ended on 02/20/2011 00:00 here).
This date is correctly parsed (GMT-3).

Now the problem begins.

I try to parse again the old DST date, and the result is wrong! It wasn’t read as a DST date!

I thought perhaps the parsing changed the Time.zone, but as it is pasted it is UTC all the time.

What is causing this ?

Thank you for reading.

Nilo

  • 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-21T04:40:42+00:00Added an answer on May 21, 2026 at 4:40 am

    You might want to change to use the ActiveSupport::TimeWithZone class in rails.

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

Sidebar

Related Questions

I start using matplotlib a month ago, so I'm still learning. I'm trying to
So I decided to start using prototype and here's my first question. I'm trying
I have to rewrite an old application and I would like to start using
I am using an old version of log4net: 1.2.0.21221. When I used the new
I'm using Ruby on Rails (Edge, the development version), and Ruby rvm 1.9.2. application.js
I was going to start using === (triple equals, strict comparison) all the time
I have decided to start using unit testing in PL/SQL, since it could be
hello i have just start using Raphael but i'm very confused in the following
I'm about to start using the MS ReportViewer in a WPF application by placing
I'm looking to start using a key/value store for some side projects (mostly as

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.