How to set time zone in Rails 5

It is the same as in previous version of Rails. But the difference is that before the following comment existed in config/application.rb:

# Set default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'

So it was easy to just grep the config/ directory for word time_zone or zone and see how to set timezone.

The above mentioned comment is missing in new Rails applications, but the way how to set timezone is still the same.

Run rails time:zones to see all available time zones, choose yours and then set it in config/application.rb.

# config/application.rb

# ...

module PatrikOnRails
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    config.time_zone = "Pacific Time (US & Canada)"
Read this next: Better SJR debugging