[英]Get postgres to show all TIMESTAMP WITH TIME ZONE columns in UTC
When I do a SELECT
statement that outputs a TIMESTAMP WITH TIME ZONE
column, it doesn't include the time zone in the output. 当我执行输出
TIMESTAMP WITH TIME ZONE
列的SELECT
语句时,它在输出中不包含时区。 It just outputs the date and time without the timezone, after converting it to my local timezone. 在将日期和时间转换为我的本地时区后,它只输出不带时区的日期和时间。
I have 2 questions: 我有两个问题:
TIMESTAMP WITH TIME ZONE
columns to always display their time zones in the output, rather than the default of omitting it? TIMESTAMP WITH TIME ZONE
列以始终在输出中显示其时区,而不是默认省略时区? TIMESTAMP WITH TIME ZONE
columns to output with a default time zone of UTC
? TIMESTAMP WITH TIME ZONE
列以默认的UTC
时区输出? I know there's ways to do this on a per-query basis, but I'd like to do it in every case with needing to modify any queries. for one column: 一栏:
SELECT colname AT TIME ZONE 'UTC' FROM tablename;
for all 对全部
SET TIMEZONE TO 'UTC';
see also ALTER
... SET
... 另请参阅
ALTER
... SET
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.