Hi all,

I am trying to change a date from a time zone to UTC.

First I set the time zone and then get its offset from UTC.

Then I am trying to change the time zone of my date by substracting the
offset  but it failed.

---------------
Time.zone = @time_zone # 'Paris'
@offset   = Time.zone.utc_offset() # @offset = 3600

# @date = now
@date = @date - @offset

# @date should be now - 1 but its somewhere in 1998 ...
---------------

Reading the pick axe Time documentation, when you substract something
from a date, it should be in seconds, which is the case. But with my
code, it failed.

What can I do to fix that ?
-- 
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to