2,497
社区成员
发帖
与我相关
我的任务
分享
ts:=Tstringlist.Create;
con1.GetTableNames(ts,false);
qry1.SQL.Add('select 日期 from '+ts[i]+'');
qry1.Prepared;
qry1.Open;
Dt:=Trunc(StrToDate(DateTimeToStr(Date())) - StrToDate(qry1.Fields[0].AsString));//系统时间与查询到的时间相减
我现在是这样的风湿,怎么改?var NowDate,Date1,Date2,Date3,Date:TdateTime;
MyList:TListString;
S:string;
begin
MyList:=TListString.Creat;;
NowDate:=Now;
Date1:=ClientDateSet1.FieldByName('时间').AsDateTime;
Date2:=ClientDateSet2.FieldByName('时间').AsDateTime;
Date3:=ClientDateSet3.FieldByName('时间').AsDateTime;
//......
if (NowDate-Date1)1<NowDate-Date2
then Date:=Date1
esle Date:=Date2;
if Date>(NowDate-Date3) then Date:=Date3;
S:=DateTimetoString(ID,'yyyy-mm-dd hh:nn:ss',Date);
MyList.add('最近时间:'+S);
// ......
Memo1.Item.text:=MyList.Text;
Mylist.Free;
end;
大致如此。