Follow Along as I Stumble on the Path to Learning RoR

Changing the Date from UTC to Another Time Zone

I had some calculations that I wanted to do according to my app’s time zone and not UTC. was changing earlier than I wanted it to since the default is to use UTC.  However, I found a simple way to fix this:

in application.rb:

config.time_zone = ‘Eastern Time (US & Canada)’

then you can use this to get the date in the time zone you set:


If do not want to set the time_zone in the configuration, you can just do this: ‘Eastern Time (US & Canada)’).to_date


Comments are closed.