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.
PostgreSQL assumes your local time zone for any type containing only date or time. All timezone-aware dates and times are stored internally in UTC . They are converted to local time in the zone specified by the TimeZone configuration parameter before being displayed to the client.
PostgreSQL – To modify the time zone for Amazon RDS for PostgreSQL DB instances at the database level, set the value of the time zone parameter in a custom parameter group. The time zone parameter takes the input form of UTC-X or UTC+X. X is the number of hours that the time zone is offset from UTC time.
psql (9.1.4) Type "help" for help. richardh=> show timezone; TimeZone ---------- GB (1 row) richardh=> set timezone='UTC'; SET richardh=> show timezone; TimeZone ---------- UTC (1 row) richardh=> set timezone='US/Eastern'; SET richardh=> show timezone; TimeZone ------------ US/Eastern (1 row) richardh=> set timezone='blah'; ERROR: invalid value for parameter "TimeZone": "blah"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With