简体   繁体   English

DateToStr和Delphi XE2

[英]DateToStr and Delphi XE2

I upgraded one project from XE to XE2 and I noticed that DateToStr doesn't work exactly as before. 我将一个项目从XE升级到XE2,我注意到DateToStr并不像以前那样完全正常工作。

If I try to covert a null date to str it gives "Invalid floating point operation". 如果我尝试将空日期转换为str,则会给出“无效的浮点运算”。 While this was not there in XE. 虽然这在XE中不存在。

Why there is this difference? 为什么会有这种差异? Are there similar behaviours for other functions? 其他功能是否有类似的行为? (I mean some function that in a similar case = converting a null value changes the behaviour) (我的意思是在类似情况下的一些函数=转换空值会改变行为)

After investigating I realized that this design choice made by Embarcadero in XE2 will affect a lot of old code. 经过调查,我意识到Embarcadero在XE2中做出的这种设计选择会影响很多旧代码。 Wherever possible I replaced DateTimeToStr or I added checks for NULL dates before trying to convert to string. 在可能的情况下,我替换了DateTimeToStr或者在尝试转换为字符串之前添加了对NULL日期的检查。

Also DevExpress have some problems with their components because of this issue. 此外,由于此问题,DevExpress的组件也存在一些问题。

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

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