Postgresql 如何在postgres中将列数据从GMT时区转换为localtime?

Postgresql 如何在postgres中将列数据从GMT时区转换为localtime?,postgresql,Postgresql,我有一个列“last_status_change_date”,其中包含GMT时间戳中的数据。我需要在“GMT-6”中转换此数据。如何实现此目标 select last_status_change_date from bss_calling_card where card_sn ='030400091074'; last_status_change_date ------------------------- 2020-01-03 17:06:51

我有一个列“last_status_change_date”,其中包含GMT时间戳中的数据。我需要在“GMT-6”中转换此数据。如何实现此目标

 select last_status_change_date from bss_calling_card where  card_sn ='030400091074'; 
          last_status_change_date
    -------------------------
     2020-01-03 17:06:51
    (1 row)
结果集应如下所示:

last_status_change_date
        -------------------------
         2020-01-03 11:06:51
        (1 row)

没有时区的时间戳的谬误。尝试:

select (cast(last_status_change_date as timestamp with time zone) at time zone 'UTC') at time zone '-06:00' last_status_change_date from ...;

这将获取您的时间戳,并将类型转换为带时区的时间戳,然后通知Postgres它当前所在的时区,最后为您所需的结果指示时区

列的数据类型是什么?没有时区的时间戳(0)