我使用 PostgreSQL 16 并运行以下查询。
select (current_timestamp AT TIME ZONE 'UTC');
返回 UTC 时间,不附加时区。
2024-10-04 18:44:59.34674
如何检索以下输出?
2024-10-04 18:44:59.34674+00:00
将结果投射到
timestamptz
应该可以。
SELECT (current_timestamp AT TIME ZONE 'UTC')::timestamptz;
将会产生
2024-10-04 19:22:29.151774 +00:00