How to set timezone for Postgres psql?

前端 未结 4 2109
北海茫月
北海茫月 2020-12-29 04:07

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)
...

$ psq         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 04:54

    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"
    

提交回复
热议问题