Time Zone changing with strftime?


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.


The answer:


config.active_record.time_zone_aware_attributes = false


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