第1个回答 2009-04-29
有现在的函数
var
year, month, day, hour, minute, second, misecond: integer;
begin
DecodeDateTime(now, year, month, day, hour, minute, second, milsecond);
end;
注意在uses里加上DateUtils
不好意思看错题目了~~
那就用FormatDateTime就可以了~~
var
str: string;
begin
str := FormatDateTime('yyyy-mm-dd hh:mm:ss', Now);
end;
第2个回答 推荐于2016-11-01
比如把当前的日期时间转成字符串,放在EDIT1里:
edit1.text:=formatdatetime('yyyy-mm-dd hh:mm:ss',now);
用formatdatetime函数就可以解决。本回答被提问者采纳