Forum: Ruby on Rails about local time

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
daociyiyou (Guest)
on 2008-10-21 06:35
(Received via mailing list)
I want to read a database column value to use in my app.That is
t.timestamp.I use it like this:
<%=user.created_at-%>,but the displayed time is based on utc while
what i want it to be is chinese BeiJing time.How do i manage this? set
config.time_zone? The stored time data value is different from the
displayed time data value?
daociyiyou (Guest)
on 2008-10-21 10:13
(Received via mailing list)
any one help me?
Mukund (Guest)
on 2008-10-21 12:44
(Received via mailing list)
I recommend you store the data in your database in UTC format.   You
can always reformat the data being displayed to local time zone.
Have a look at the tzinfo plugin for proper conversion to local time
with day light savings, etc

http://tzinfo.rubyforge.org/doc/files/README.html
.
This topic is locked and can not be replied to.