- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
System.DateUtils.EncodeDateTime()
的文档说:
Valid hour values are 0 through 24. (If the specified hour is 24, the minute, second, and millisecond values should all be 0, and the resulting TDateTime value represents midnight at the end of the specified day and the beginning of the next day).
如果我尝试执行 EncodeDateTime(2008,1,1,24,0,0,0);
我会收到异常。
我做错了什么?
最佳答案
这是文档中的缺陷。实际工作的 TryEncodeTime
的实现如下:
function TryEncodeTime(Hour, Min, Sec, MSec: Word; out Time: TDateTime): Boolean;
var
TS: TTimeStamp;
begin
Result := False;
if (Hour < HoursPerDay) and (Min < MinsPerHour) and (Sec < SecsPerMin)
and (MSec < MSecsPerSec) then
begin
....
Result := True;
end;
end;
由于 HoursPerDay
为 24
,很明显该实现与文档不一致。
这甚至不是随着时间的推移而改变的行为。 TryEncodeTime
方法始终以这种方式运行。例如,Delphi 5 中的类似函数如下所示:
function DoEncodeTime(Hour, Min, Sec, MSec: Word; var Time: TDateTime): Boolean;
begin
Result := False;
if (Hour < 24) and (Min < 60) and (Sec < 60) and (MSec < 1000) then
begin
Time := (Hour * 3600000 + Min * 60000 + Sec * 1000 + MSec) / MSecsPerDay;
Result := True;
end;
end;
关于delphi - Embarcadero 的文档中的 EncodeDateTime 是否错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49557789/
有谁知道 C#/Excel 的 Delphi 中的等价物是什么财务职能 : PMT、IPMT 和 PPMT ? 最佳答案 财务功能在System.Math单元。 他们有全名,如 NetPresentV
我正在使用 Embarcadero C 编译器(在 Windows 7 下)来创建控制台应用程序。 我使用的早期版本允许我在 Windows 下设置窗口的大小,并且它会很乐意解决我设置的任何大小(使用
这里有一个简短的问题: 我正在尝试在 32 位 Windows 7 上使用 Embarcadero C++ Builder XE3 试验内联汇编,特别是为了开始重新自学汇编,以备将来实际应用的可能性。
随着我对 VS 2010 越来越失望,我试图找到一些替代方案,我正在寻找 Embarcadero 的新版 C++ env。 当 VS 几乎主导市场时,学习新的(我认为不流行的)产品有什么意义吗? 谢谢
我正在使用 Embarcadero C++Builder 编译器。我想知道是否有办法在子类中隐藏使用 __property 关键字声明的属性。 例如,我正在创建一个派生自 TPanel 的控件,我在其
我正在尝试从Delphi 2007迁移到Embarcadero RAD Studio XE。 我收到大量警告。 它们都看起来像这样:我有一个声明“字符串”的过程: procedure SendMail
System.DateUtils.EncodeDateTime() 的文档说: Valid hour values are 0 through 24. (If the specified hour i
有人可以告诉我在哪里可以找到好的 BDE 安装程序吗? 这些链接将不再有效: http://info.borland.com/devsupport/bde/bdeupdate.html 最佳答案 ht
我在 FireMonkey 3D 中搜索了相机旋转和缩放的示例。就像使用鼠标左键围绕场景旋转相机并使用鼠标滚轮放大和缩小一样。 有人可以帮我吗? 最佳答案 下面的表单显示了一个简单的演示,只需保存 .
我需要一个用于 C++ 构建器的 WindowHandleToPlatform 示例我想使用句柄对表单执行 bitblt 和其他功能我可以使用 VCL 做到这一点并且效果很好。认为 WindowHan
我想知道如何在 TTcpServer 类上使用已连接的客户端?我在方法“ServerAccept”上连接了一个客户端,下一步是什么?我如何与他们合作?我需要从 ServerAccept 开始一个新线程
我有一个对象要删除: XMLDoc = new TXMLDocument(NULL); 但我不知道该怎么做...它不起作用: delete XMLDoc; XMLDoc->free(); 当我尝试只
我有一个带有结构的元素类,我想在数组中放置一些对象。我的类(class): class element { public: //properties AnsiString ON; /
我想就如何处理 Embarcadero CB10.1 的重新进入问题提出一些建议。在“禁用所有优化”设置为 true 的调试配置中编译。我在 Win7 上运行。 我有一个简单的测试用例。带有两个按钮的
试图让 NFC 在 Embarcadero XE5 中的 Android 上运行。从以下内容开始:https://forums.embarcadero.com/thread.jspa?threadID
昨天,我在 embarcadero delphi 2010 中安装了专为 Delphi 7 设计的 TPing 组件,但今天我注意到当我单击“开始”按钮时,由于访问冲突错误,该组件导致我的应用程序崩溃
将 TChangeTabAction 标准操作添加到我的操作列表后,我写了一个这样的函数: procedure TfrmMain.ChangeTab(TargetTab: TTabItem; Reve
我尝试过在 XE7、32 位下构建一些较旧的应用程序。当我在 XP 下执行它们时,它们执行得很好,尽管 https://www.embarcadero.com/products/cbuilder/fa
我正在尝试调试一段在单行中包含多个函数调用的密集代码。我想单步执行我编写的所有代码,但在这样做时,我不断地发现自己在提供的源代码中,包括汇编代码。 这发生在客户站点上运行 XE5 的计算机上。在我自己
已关闭。这个问题是 off-topic 。目前不接受答案。 想要改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 已关闭10 年前。 社区去年审查了是否重
我是一名优秀的程序员,十分优秀!