Postgres:以特定的 UTC 格式显示时间戳
Postgres: Display timestamp in specific UTC format
我在数据库中以这种方式存储了一个时间戳:
2021-08-14 12:19:58+00
我需要用这种格式显示
2021-08-14 12:19:58 UTC
使用 to_char
函数和 TZ
格式:
SELECT to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS TZ');
to_char
══════════════════════════
2021-09-21 23:06:15 CEST
(1 row)
我在数据库中以这种方式存储了一个时间戳:
2021-08-14 12:19:58+00
我需要用这种格式显示
2021-08-14 12:19:58 UTC
使用 to_char
函数和 TZ
格式:
SELECT to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS TZ');
to_char
══════════════════════════
2021-09-21 23:06:15 CEST
(1 row)