SELECT now() AT TIME ZONE 'Asia/Calcutta';
SELECT now()::timestamp AT TIME ZONE 'Asia/Kolkata';
SELECT now()::timestamp AT TIME ZONE '5:30';
SELECT now()::timestamp AT TIME ZONE 'Asia/Katmandu';
SELECT now()::timestamp AT TIME ZONE 'NPT';
设置整个会话的时区:
SET time zone 'Asia/Calcutta';
RESET time zone;
pg_timezone_names
和pg_timezone_abbrevs
中查找更多信息。SELECT *
FROM pg_timezone_names
WHERE utc_offset BETWEEN '05:00:00' AND '06:00:00'
ORDER BY utc_offset;
SELECT *
FROM pg_timezone_abbrevs
WHERE utc_offset BETWEEN '05:00:00' AND '06:00:00'
ORDER BY utc_offset;
PostgreSQL手册关于AT TIME ZONE
结构的介绍。关于时区。
Asia/Kolkata
。 - Erwin BrandstetterAsia/Kolkata
。 @araqnid: 我正在使用9.1版本,但我找不到相关的9.1文档,所以发了8.1版本的。 - user1144616