Try this.

>> evt.start_time.in_time_zone('Arizona')

Check out 
http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Time/Zones.html.
And http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html
lists all the available timezones.

--
Robert Zotter
Zapient, LLC
Ruby on Rails Development and Consulting

http://www.zapient.com
http://www.fromjavatoruby.com

On Oct 31, 3:40 pm, "Pete Barnes" <[EMAIL PROTECTED]> wrote:
> Robert,
>
> I think what I need to do is convert a DateTime value. stored in the MYSQL
> db, of 2008-10-31 21:00:00 (UTC) to 2008-10-31 14:00:00 -0700 (AZ time).
>
> Cheers.
>
> **
>
> On Fri, Oct 31, 2008 at 4:20 PM, Robert Zotter <[EMAIL PROTECTED]> wrote:
>
> > Charles,
>
> > I am not sure what you want to accomplish. If you want to display the
> > time you have listed in your database you can always use the
> > following.
>
> > <%= h evt.start_time.to_s(:db) %>
>
> > Is this what you are looking for?
> > --
> > Robert Zotter
> > Zapient, LLC
> > Ruby on Rails Development and Consulting
>
> >http://www.zapient.com
> >http://www.fromjavatoruby.com
>
> > On Oct 31, 3:17 pm, Charles <[EMAIL PROTECTED]> wrote:
> > > I'm new to Ruby and have been pulling my hair out trying to figure out
> > > an issue with displaying DateTime fields. I have programmed a very
> > > simple app in Windows with a MySQL 5 database. The DateTime fields
> > > appear to be saved in a UTC format. When displaying DateTime
> > > information with the following -
>
> > > <%=h evt.start_time.to_time %>
>
> > > I see the following output (on Windows)
>
> > > 2008-10-31 03:00:00 -0700
>
> > > In the database the value of the start_time field is - 2008-10-31
> > > 10:00:00. It appears "evt.start_time.to_time" is displaying DateTime
> > > in localtime (MST).
>
> > > However, the same code on my LINUX (CentOS 5) box yields the following
> > > output -
>
> > > 2008-10-31 10:00:00 UTC
>
> > > What am I missing? I've verified time, timezone and NTP settings on
> > > the LINUX box.
>
> > > I have the following setup in my environment.rb -
>
> > > config.time_zone = 'Arizona'
>
> > > I'm at a complete loss. Any help would be greatly appreciated.
>
> > > C
--~--~---------~--~----~------------~-------~--~----~
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