Postgresql Postgres如何通过日光节约将毫秒转换为日期
在postgres DB中,日期时间以毫秒形式存储为bigint。我需要将它们转换为日期时间。函数to_timestamp()未考虑日光节约设置。 例如,我有以下DB值:Postgresql Postgres如何通过日光节约将毫秒转换为日期,postgresql,timezone,psql,dst,Postgresql,Timezone,Psql,Dst,在postgres DB中,日期时间以毫秒形式存储为bigint。我需要将它们转换为日期时间。函数to_timestamp()未考虑日光节约设置。 例如,我有以下DB值: select username, created_timestamp, to_timestamp(created_timestamp/1000) from user_entity; username | created_timestamp | to_timestamp ---
select username, created_timestamp, to_timestamp(created_timestamp/1000) from user_entity;
username | created_timestamp | to_timestamp
--------------------------+-------------------+-----------------------
user_15 | 1567066962775 | 2019-08-29 08:22:42+00
user_16 | 1581145146219 | 2020-02-08 06:59:06+00
我希望看到以下夏令时效果:
user_15 | 29.08.2019, 09:22
user_16 | 08.02.2020, 06:59
如果将
timezone
设置为要查看字符串格式的时区,则将得到所需的结果:
SET timezone = 'Europe/London';
PostgreSQL将带有时区的时间戳格式化为当前会话时区。是否可以使用jdbc url参数设置客户端时区?当然,使用
选项参数传递时区。看见