当前位置:编程学习 > Delphi >>

计算时间我们会有误差?delphi

为什么会有这样的情况?

代码

procedure TForm1.Button1Click(Sender: TObject);
var
d1,d2:tdatetime;
minutes,days,hours:integer;
begin
d1 := strtodatetime(edit1.Text);
d2 := strtodatetime(edit2.Text);
minutes := minutesbetween(d1, d2);
hours := hoursbetween(d1, d2);
days := daysbetween(d1, d2);
edit3.Text := inttostr(days);
edit4.Text := inttostr(hours);
edit5.Text := inttostr(minutes);
end;

答案:

在使用MinutesBetween求两个时间之间相差多少分钟的问题

http://blog.csdn.net/aroc_lo/archive/2009/02/26/3939380.aspx


在使用MinutesBetween求两个时间之间相差多少分钟时,经常出现分钟误差。上面是解决办法;

上一个:delphi界面怎么设置像QQ一样自动隐藏
下一个:谁有循序渐进的Delphi教程?谢谢!

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,