Setting PostgreSQL Time Zone in Hanami 2.2 app

Do you need per-session timezones? Because there is an app-level setting:

Hanami.app.configure_provider :db do
  before :start do
    Sequel.application_timezone = :local
  end
end

Set TZ=Europe/Vienna in your system environment when loading the app, you should see:

bookshelf[development]> app["db.gateway"].connection.fetch("select current_timestamp").to_a
[bookshelf] [INFO] [2025-06-06 02:32:41 +0200]   Loaded :postgres in 1ms select current_timestamp
=> [{current_timestamp: 2025-06-06 02:32:41.480931 +0200}]
4 Likes