简体   繁体   English

如何将UTC时间戳转换为带时区的时间戳

[英]How to convert UTC Timestamp to Timestamp with time zone

I am using PostgreSql and having a column with datatype as Timestamp with time zone. 我正在使用PostgreSql并具有一列数​​据类型为Timestamp的时区。 But from the server its receiving a 'UTC Timestamp' value. 但是从服务器接收到“ UTC时间戳”值。 I need to convert it to 'Timestamp with time zone' so that further comparisons can be done if required. 我需要将其转换为“带有时区的时间戳记”,以便在需要时可以进行进一步的比较。

How can I do that. 我怎样才能做到这一点。 Please suggest me the ways to convert it and then store. 请建议我将其转换然后存储的方法。

Use the AT TIME ZONE operator to covert 使用“ AT TIME ZONE 操作员进行隐蔽

  • timestamps without time zone s to timestamps with time zone s timestamps without time zone s的timestamps with time zonetimestamps with time zone s的timestamps with time zone
  • timestamps with time zone s to timestamps without time zone s timestamps with time zone s的timestamps without time zone s的timestamps without time zone

timestamps without time zone (aka. timestamp ) always considered to be in UTC. timestamps without time zone (也称为timestamp )始终被视为UTC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM