Thanks a lot i got it..

On Apr 8, 9:50 am, Rick Schumeyer <rschume...@ieee.org> wrote:
> Either I'm not understanding what you want, or this is real easy.
>
> Let's say I have a class Event with a field edate, which is stored in
> UTC:
>
> >> e = Event.find(1)
>
> => #<Event id: 1, edate: "2009-03-30 12:00:00">>> e.edate
>
> => Mon, 30 Mar 2009 12:00:00 UTC +00:00>> e.edate.class
>
> => ActiveSupport::TimeWithZone
>
> Now Let's say you want the time in "America New York" zone.  First,
> create a new TimeZone object:
>
> >> ze = ActiveSupport::TimeZone.new("Eastern Time (US & Canada)")
>
> => #<ActiveSupport::TimeZone:0xb780fb80 @utc_offset=-18000,
> @name="Eastern Time (US & Canada)", @tzinfo=#<TZInfo::DataTimezone:
> America/New_York>>
>
> Then:>> e.edate.in_time_zone(ze)
>
> => Mon, 30 Mar 2009 08:00:00 EDT -04:00
>
> So in summary, I think you just need this:
>
> local_zone = ActiveSupport::TimeZone.new("name_of_time_zone")
> local_time = time_in_utc.in_time_zone(local_zone)
>
> You will need to see the documentation for TimeZone for the names of
> all the zones.

--~--~---------~--~----~------------~-------~--~----~
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