如何将印度时区添加到 Postgresql? [英] How to add Indian timezone to Postgresql?
问题描述
我正在尝试找出将印度标准时间(来自 UTC 的 +0530)添加到 postgresql (9.1) 的最简单方法.
i'm trying to find out what's the easiest way to add India Standard Time (+0530 from utc) to postgresql (9.1).
我尝试了将它插入表格的愚蠢做法,但没有成功.
i tried the silly thing of trying to insert it into the table, but it doesn't work.
插入 pg_timezone_abbrevs values('INDIA','05:30:00');
insert into pg_timezone_abbrevs values('INDIA','05:30:00');
多年前其他人发现的问题,谷歌搜索 在旧邮件列表中告诉我.但没有找到简单的解决方案.
the problem what detected years ago by other people, Googling in old mailing lists tells me. but not simple solution found.
推荐答案
底线:不要使用 IST,这是以色列时区,而不是印度时区.使用亚洲/加尔各答".相反.
Buttom line: don't use IST, that's Israel time zone, not Indian time zone. use 'Asia/Kolkata'. instead.
Postgres 对此的文档含糊不清,但请注意:
Postgres documentation of this is vague, but notice that looking at:
SELECT name, abbrev, utc_offset, is_dst FROM pg_timezone_names;
SELECT name, abbrev, utc_offset, is_dst FROM pg_timezone_names;
会给你不同的选项,而不是显示所有可用的时区.
will give you different options that those of, not showing all the available timezones.
SELECT abbrev, utc_offset, is_dst FROM pg_timezone_abbrevs;
SELECT abbrev, utc_offset, is_dst FROM pg_timezone_abbrevs;
并且编辑此文件没有任何效果.别打扰.也许您需要手动更改另一个配置以包含它.
and editing this file doesn't have any effect. don't bother. perhaps you need to manually change another config to include it.
/usr/share/postgresql/9.1/timezonesets/Asia.txt
/usr/share/postgresql/9.1/timezonesets/Asia.txt
这篇关于如何将印度时区添加到 Postgresql?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!