By default, Postgres uses the system timezone as the default. This usually isn't what you want for a database on your local dev machine. Generally, the timezone should be UTC. The database not being in the same timezone as production will cause bugs that don't exist locally but do exist on production.
The most common answer I find when I'm searching for how to do this for the thousandth time is this:
SET TIME ZONE 'UTC';
This works, but will not persist across restarts.
The more persistent way to accomplish this is to modify
postgresql.conf. To find where the
postgresql.conf file is on your system, you can run this query in
Once you have found the location of the file, you can find this line in the file, uncomment it, and change the value to be 'UTC'.
#timezone = '(defaults to server environment setting)'
This is what the line should look like after the change:
timezone = 'UTC'
After making the change, we need to reload Postgres so the config change will take effect. This can be done by either running
pg_ctl reload on the command line, or running
SELECT pg_reload_conf(); from