读书人

getdata有关问题

发布时间: 2012-02-25 10:01:49 作者: rapoo

getdata问题
小弟有问题请教大家!!~望大家赐教~!
问题:
  我现在有个控件label4上显示的时间如:2007-01-23,我想要得到的是把现在的
时间减去label4上时间.
  现在需要写个函数,把获得的结果输出到label6控件上去..
望大家赐教。.小弟在此感谢..(希写完整些)

[解决办法]
Label6.Caption := DateTimeToStr(Now - StrToDateTime(Label4.Caption));
[解决办法]
支持老妖,只显示日期的
Label6.Caption := DateToStr(Date - StrToDate(Label4.Caption));

[解决办法]
function CompDate(ADate: String): String;
begin
Result := DateToStr(Date-StrToDate(ADate));
end;
[解决办法]
function tform1.getdate(str1,str2:string):string;//写成类的函数
begin
result:=datetostr(strtodate(str1)-strtodate(str2));
end;
//调用
label6.caption:=getdate(datetostr(date),label4.caption);

读书人网 >.NET

热点推荐