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

Oracle TIMESTAMP WITH TIMEZONE named zone vs offset(Oracle TIMESTAMP WITH TIMEZONE 命名区域与偏移量)

本文介绍了Oracle TIMESTAMP WITH TIMEZONE 命名区域与偏移量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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);

这篇关于Oracle TIMESTAMP WITH TIMEZONE 命名区域与偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Oracle TIMESTAMP WITH TIMEZONE 命名区域与偏移量

基础教程推荐