Delphi 制作倒计时,网页版的倒计时比较多了,Delphi做的倒计时也不算高深,这就是一个简单的倒计时例子,用来计算距离毕业的时间有多少。下面是部分代码:
begin
day:=int(dayspan(now(),strtodatetime('2008-5-15 00:00:00 ')));
have:=dayspan(now(),strtodatetime('2008-5-15 00:00:00 '))-day;
hour:=int(have*24);
have:=have*24-hour;
min:=int(have*60);
have:=have*60-min;
sec:=int(have*60);
have:=have*60-sec;
hm:=int(have*1000);
label1.Caption:='今天距毕业还有';
label1.Caption:=label1.Caption floattostr(day) '天'
floattostr(hour) '小时' floattostr(min) '分'
floattostr(sec) '秒' floattostr(hm) '毫秒';
end;