Forum: Ruby on Rails Time Zone changing with strftime?

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.
B6a2e2c1454c56eb686c5a38b5f73d02?d=identicon&s=25 Joel Dezenzio (elricstorm)
on 2011-07-08 18:17
Why is strftime changing the date to UTC when I have the time zone set
and the DB results show the correct datetime format?

In Schedules Database:

Column date_scheduled = 2011-09-11 16:15:00

schedule.date_scheduled.strftime("%I:%M %p")
=> 12:15 PM  (should show 4:15 PM)

In application.rb:

config.time_zone = 'Eastern Time (US & Canada)'

Does time_zone configuration not work in Rails 3?  Little things like
this drive me batty because I think they work a particular way and then
I find they do not.

The time in my entire rails app should be defaulting to Eastern Time
only, regardless of who views my site.
B6a2e2c1454c56eb686c5a38b5f73d02?d=identicon&s=25 Joel Dezenzio (elricstorm)
on 2011-07-08 18:24
And, in case someone says to use "in_time_zone", you can't use that with
a string.  I've already had to force convert my time zone components
from UTC into the database using in_time_zone.  But, I don't believe I
should have to force another time conversion in order to format a time
string.
B6a2e2c1454c56eb686c5a38b5f73d02?d=identicon&s=25 Joel Dezenzio (elricstorm)
on 2011-07-08 21:05
The answer:

application.rb

config.active_record.time_zone_aware_attributes = false
This topic is locked and can not be replied to.