Preparing your local Postges DB. Resolving timezone headache for developers.
Preparing your local Postges DB Resolving timezone headache for developers. To set your PostgreSQL server time to UTC, you can change the setting globally, per database, per user, or for a single session. Permanent Global Change Modify the main configuration file to set the default for the entire server. Locate the file : Find your postgresql.conf file by running this SQL command in your database: sql SHOW config_file; Use code with caution. Edit the file : Open postgresql.conf and find the timezone parameter. Change it to: text timezone = 'UTC' Use code with caution. Apply changes : Reload the configuration without restarting the server by running: sql SELECT pg_reload_conf(); Use code with caution. (Alternatively, use pg_ctl reload from your terminal) . Permanent Database or User Change If you only want specific databases or users to use UTC, use these SQL commands: Per Database: ALTERDATABASE your_database...