How do I set timezone for psql to something other than my default (US/Central)? Here’s what I’ve tried so far:
$ psql
psql (9.1.4, server 9.0.4)
...
$ psql -c 'show timezone'
TimeZone
------------
US/Central
$ psql --set=timezone=US/Eastern -c 'show timezone'
TimeZone
------------
US/Central
$ psql --variable=timezone=US/Eastern -c 'show timezone'
TimeZone
------------
US/Central
Edit: I don’t want to change the server timezone, just the client.
Edit #2: I want it in non-interactive mode.
The psql doc says:
But with the timezone it does not seem to work, perhaps because because of this:
So, it seems you must either use the SET command inside psql, or either set the PGTZ environment variable:
Of course, if you are OK with setting the timezone globally for the user (not just for this individual psql instance), you might set that variable in its
.bashrcfile (if in Linux)