On Sun, Aug 28, 2011 at 8:09 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
> On Aug 28, 2:56 pm, comopasta Gr <li...@ruby-forum.com> wrote:
> > Hi,
> >
> > So I store Visit records in UTC: 2011-08-28 13:23:48.714506
> > I am in timezone +3 so I can verify that the stored created at is in
> > UTC.
> >
> > Rails.logger.debug visits.last.created_at.class returns
> > ActiveSupport::TimeWithZone
> >
> > I'm using pgAdmin3 and when checking the table on the UI app you can see
> > the datatypes. Strangely there in the UI of pgAdmin3 it reads
> > "created_at timestamp without time zone". That is odd.
> >
> > Based in what I've read the data is in DB in UTC but when it pulls it
> > from the db it should convert it to local automatically.
> >
> > I am in zone +3 so I should get 16:23:48 for the record above. But it
> > still comes in UTC.
>

When you say this, how are you determining that it 'still comes in utc'?
>From what you see on a view?

Fred is right, for example on a certain app of mine the user can set their
time zone so on the app controller I set 'Time.zone = ...' in a before
filter for the user. You could set this per user or app wide.


> >
> > Any hints what could be the problem?
> >
>
> It converts the utc value from utc to whatever Time.zone is. Unless
> you're setting Time.zone elsewhere, because you've set
> config.time_zone to utc, Time.zone will be utc too. Try setting
> config.time_zone to the desired timezone (don't forget to restart your
> app)
>
>

> Fred
>
> > --
> > Posted viahttp://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.
>
>

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