Reputation: 1461
I have the following:
config/application.rb
config.time.zone = 'Eastern Time (US & Canada)'
config.active_record.default_timezone = 'Eastern Time (US & Canada)'
controllers/time_trackers_controller.rb
@track_it.clock_in = Time.zone.now
The time now in my time zone (Eastern Time) is supposed to be 13:02 but if I save it in the database it shows up as 17:02 and I don't understand why. Any tips on what I might be doing wrong?
Upvotes: 0
Views: 104
Reputation: 45074
I believe Rails converts everything to UTC before it puts it in the database. So what you're seeing is totally normal, and when you pull the record back out of the database, the time zone will be Eastern.
Upvotes: 1