I was working with the method "in_time_zone" for the class
ActiveSupport::TimeZone, when I found an unwanted behavior.

I want to set my sights so that display the times for the main zone of
Brazil (UTC-3). During the period not DST there is no problem.
Instead to view the times for the period DST there are a problem: the
southern Brazilian states adopt DST (which means UTC-2), while the
states in the north do not use DST (which means UTC-3).

then to overcome this I was going to do this:

#on application.rb
config.time_zone = 'Brasilia'

#on a generic view

<%
  # generate a time in the summer austral hemisphere
  time_in_summer_austral_hemisphere = Time.local(2010,1,1)
  # set the timezone to UTC-2 (DST zone)
  time_in_brazilian_dst =
time_in_summer_austral_hemisphere.in_time_zone(-2)
  # set the timezone to UTC-3 ( zone without DST)
  time_in_brazilian_not_dst =
time_in_summer_austral_hemisphere.in_time_zone(-3)

  puts time_in_brazilian_dst
  # Fri, 01 Jan 2010 00:00:00 GST -02:00
  puts time_in_brazilian_not_dst
  Fri, 01 Jan 2010 00:00:00 BRST -02:00
%>

As you can see, both the conversion to UTC-2 or UTC-3 shows that the
same time

anyone have any idea why this behavior?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to