Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Postgres如何通过日光节约将毫秒转换为日期_Postgresql_Timezone_Psql_Dst - Fatal编程技术网

Postgresql Postgres如何通过日光节约将毫秒转换为日期

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 ---

在postgres DB中,日期时间以毫秒形式存储为bigint。我需要将它们转换为日期时间。函数to_timestamp()未考虑日光节约设置。 例如,我有以下DB值:

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参数设置客户端时区?当然,使用
选项
参数传递
时区。看见