Here is the following from my console:

>> Time.now
=> Mon Sep 22 11:33:34 +0200 2008
>> Time.now.utc_offset
=> 7200
>> TimeZone[Time.now.utc_offset]
=> #<TimeZone:0x11aea90 @tzinfo=nil, @utc_offset=7200, @name="Athens">
>> Time.now.in_time_zone(TimeZone[Time.now.utc_offset])
=> Mon, 22 Sep 2008 12:34:22 EEST +03:00

(I am in Spain - CET - and running on OS X with the correct timezone)

The Time.now correctly gives me the time, and the correct UTC offset
of 2 hours. It is the summer, so we are 2 hours ahead of UTC. We are
still one hour ahead of London, but London itself is an hour ahead as
they too switch to a summer time (BST).

ruby tells me that my utc_offset is 7200 - which is correct. But...
when I pull out the timezone it gives me the wrong one. Athens is 3
hours ahead of UTC, not 2 (at this time of year). So, when I convert a
time using the timezone it gives me it is an hour out!

I had hoped that time zone woes were behind me after switching to RoR
from Java. But it still seems to be a problem.

How can I get the correct Time Zone?

There is a bug tracked (http://dev.rubyonrails.org/ticket/4551) but it
seems to be set to closed... but it definitely isn't fixed!

Right now I am doing this:

offset = Time.now.dst? ? 60 : 0

Anyone have any better solutions?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to