W
wolf_zj
Unregistered / Unconfirmed
GUEST, unregistred user!
下面程序用来计算两个时间之间的差值 计算出来的小时、分、秒差值是正确的,但日期
上显示出来的却是1900-1-9,根本看不出来差了几天。不知道为什么?(delphi6,windows xp)
var
d,d1,d2:tdatetime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
d2:=StrToDateTime('2002-4-28 15:00:00');
d1:=StrToDateTime('2002-4-18 12:00:00');
d:=d2-d1;
DecodeDate(d, Year, Month, Day);
DecodeTime(d, Hour, Min, Sec, MSec);
Label1.Caption:=IntToStr(year)+'-'+IntToStr(month)+'-'+IntToStr(day)+'-'+IntToStr(hour)+'-'+IntToStr(min)+'-'+IntToStr(sec);
上显示出来的却是1900-1-9,根本看不出来差了几天。不知道为什么?(delphi6,windows xp)
var
d,d1,d2:tdatetime;
Year, Month, Day, Hour, Min, Sec, MSec: Word;
begin
d2:=StrToDateTime('2002-4-28 15:00:00');
d1:=StrToDateTime('2002-4-18 12:00:00');
d:=d2-d1;
DecodeDate(d, Year, Month, Day);
DecodeTime(d, Hour, Min, Sec, MSec);
Label1.Caption:=IntToStr(year)+'-'+IntToStr(month)+'-'+IntToStr(day)+'-'+IntToStr(hour)+'-'+IntToStr(min)+'-'+IntToStr(sec);