首页 > 数据库技术 > 详细

postgreSQL使用杂谈

时间:2017-11-07 11:05:15      阅读:294      评论:0      收藏:0      [点我收藏+]

由于当时是在美国安装的postgreSQL ,导致回到上海后使用时,发现时间数据显示不正确。

To acomplish the timezone change in Postgres 9.6 you must:

(1)查看当前timezone:

  show timezone;

或者在pgAdmin 4上查看:

技术分享

 The time zone is a session parameter. So, you can change the timezone for the current session.

set timezone TO Asia/Shanghai;

Note: ‘set timezone To ..‘ only sets the timezone for the current session and if you change the timezone configuration parameter in Postgresql.conf it should change the timezone for all databases.

Choose a timezone from:

SELECT * FROM pg_timezone_names;

技术分享

Search for the closest location to your zone and set example:

ALTER DATABASE postgres SET timezone TO ‘Asia/Shanghai‘;

Use your DB name.

 (2)Uncomment the "timezone" line in your postgresql.conf file and put your timezone as shown:

技术分享

(3)Restart Postgres 或者Tools>Reload Configuration (then refresh)

技术分享

 

 

 

参考:https://stackoverflow.com/questions/6663765/postgres-default-timezone

postgreSQL使用杂谈

原文:http://www.cnblogs.com/carsonzhu/p/7797907.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!