如何在Amazon Redshift中更改默认时区? [英] How to change the default timezone in Amazon Redshift?
问题描述
默认将时间戳列设置为SYSDATE,并将其存储为 UTC .是否可以更改时区,以便SYSDATE将日期和时间存储到其他时区?
Setting a timestamp column to SYSDATE by default, stores it as UTC. Is it possible to change the timezone so SYSDATE stores dates and times to a different timezone?
到目前为止,我已经检查了 SET 命令但我不确定是否可以使用它来更改时区.
So far, I've checked the SET command but I'm not sure if it is possible to use it to change the timezone.
推荐答案
基本上,答案是否定的.根据文档:
Basically, the answer is no. According to the documentation:
在用户表和Amazon Redshift系统表.
TIMESTAMP values are UTC, not local time, in both user tables and Amazon Redshift system tables.
注意不支持带有时区的时间戳.
Note Timestamps with time zones are not supported.
If you need the queries to return data in different timezone, you can use the CONVERT_TIMEZONE function, with either constant timezone value (or query parameter), or joining the result to a configuration table which contains the required timezone.
这篇关于如何在Amazon Redshift中更改默认时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!