var
i:string;
j:string;
h:string;
begin
adodataset1.close;
adodataset1.commandtext:='select from_unixtime(unix_timestamp()) as ll';
adodataset1.open;
i:=adodataset1.FieldByName('ll').asstring;
j:=formatdatetime('yyyy-mm-dd hh:mm:ss',now());
h:=i-j;
label5.Caption:=h;
end;
运行时提示 2005-04-18 10:08:22 不是一个有效的时间;
请高手帮忙!
i:string;
j:string;
h:string;
begin
adodataset1.close;
adodataset1.commandtext:='select from_unixtime(unix_timestamp()) as ll';
adodataset1.open;
i:=adodataset1.FieldByName('ll').asstring;
j:=formatdatetime('yyyy-mm-dd hh:mm:ss',now());
h:=i-j;
label5.Caption:=h;
end;
运行时提示 2005-04-18 10:08:22 不是一个有效的时间;
请高手帮忙!
解决方案 »
- 如果在DBGRID中使用下拉列表框?
- 如何用DBGrid显示DBRichEdi存的格式?
- 求助:请问如何用程序动态改变另一个窗口的图标
- 高分求ado控件的数据字典的实现(up有分,先给100分,若有完整代码给2000分)
- 哪位大仙给一个DELPHI5的下载地址。
- 表格文件(Excel)追加记录,在线等~问题解决马上结贴!
- 如何安装Microsoft Transaction Server ?
- CBX RIA框架=VCL云计算
- 一个不可失意的兼容问题(在线等侯)
- 有人能说说ehlib的使用方法吗?
- bde问题 :invalid handle in record buffer
- 1stclass4000控件与MDI窗口的问题,请教大虾!
i,j:TDateTime;
h:string;
begin
adodataset1.close;
adodataset1.commandtext:='select from_unixtime(unix_timestamp()) as ll';
adodataset1.open;
i:=adodataset1.FieldByName('ll').asDateTime;
j:=now();
h:=FormatDateTime('yyyy-mm-dd hh:nn:ss',i-j);
label5.Caption:=h;
end;
----------------->>>>>>>>>>>>>>>>>>>>>>
i,j:TDateTime;
h:string;
begin
adodataset1.close;
adodataset1.commandtext:='select from_unixtime(unix_timestamp()) as ll';
adodataset1.open;
i:=adodataset1.FieldByName('ll').asDateTime;
j:=now();
h:=FormatDateTime('hhhh-mm-dd hh:nn:ss',i-j);
label5.Caption:=h;
end;
不要FormatDatetime Now
直接使用 now 就可以了。