Oracle TIMESTAMP WITH TIMEZONE 命名区域与偏移量

2022-01-13 00:00:00 datetime timestamp timezone dst oracle

在oracle中,命名的时区是否总是存储的?

In oracle, is the named timezone always stored?

我一直在我们的系统中测试这个列,并且在某些地方时间戳显示为:

I have been testing this column within our system, and in some places the timestamp is shown as:

26-FEB-09 11.36.25.390713 AM +13:00

但其他时候是:

26-FEB-09 11.36.25.390713 AM Pacific/Auckland

如果该值被存储为前者,这是否意味着实际时区没有被存储?

If the value is being stored as the former, does that mean the actual timezone is not being stored?

我担心,因为如果未来日期仅存储一个偏移量,我们可能无法确定原始时区的实际时间,因为您可以确定与时区的偏移量,但反之则不行.

I worry because if a future date is stored with only an offset we might not be able to determine the actual time in the original timezone, because you can determine a offset from a timezone, but not vice versa.

谢谢

推荐答案

我发现打开连接时在 ODP.NET 中设置 TimeZone 和格式似乎可以解决这个问题:

I've found that setting the TimeZone and format within ODP.NET when a connection is opened seems to solve this problem:

OracleGlobalization info = conn.GetSessionInfo();
info.TimeZone = "Pacific/Auckland";
info.TimeStampFormat = "DD-MON-YYYY HH:MI:SS.FF AM";
info.TimeStampTZFormat = "DD-MON-YYYY HH:MI:SS.FF AM TZR";
conn.SetSessionInfo(info);

相关文章