Oracle TIMESTAMP WITH TIMEZONE命名为zone vs offset [英] Oracle TIMESTAMP WITH TIMEZONE named zone vs offset

查看:161
本文介绍了Oracle TIMESTAMP WITH TIMEZONE命名为zone vs offset的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在系统中测试了这一列,在某些地方,时间戳显示为: p>

  26-FEB-09 11.36.25.390713 AM +13:00 

,但其他时间是:

  26-FEB-09 11.36。 25.390713 AM太平洋/奥克兰

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



我担心,因为如果将来的日期只存在一个偏移量,我们可能无法确定原始时区的实际时间,因为你可以确定偏离时区,但反之亦然。



谢谢

解决方案

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

  OracleGlobalization info = conn.GetSessionInfo(); 
info.TimeZone =太平洋/奥克兰;
info.TimeStampFormat =DD-MON-YYYY HH:MI:SS.FF AM;
info.TimeStampTZFormat =DD-MON-YYYY HH:MI:SS.FF AM TZR;
conn.SetSessionInfo(info);


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

but other times it's:

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.

Thanks

解决方案

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命名为zone vs offset的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆