to LeeChange:
你的函数有个小问题,呵呵,procedure是不允许有Result的,另外函数的最后一句
你忘了加分号了呀。
to masterDelphi401:
用我改造过的这个函数,能够解决你的问题。
function sTot(Value: string): TDateTime;
var
y, m, d, h, mm: Word;
begin
y:=StrToInt(Copy(Value, 1, 4));
Delete(Value, 1, 4);
m:=StrToInt(Copy(Value, 1, 2));
Delete(Value, 1, 2);
d:=StrToInt(Copy(Value, 1, 2));
Delete(Value, 1, 2);
h:=StrToInt(Copy(Value, 1, 2));
Delete(Value, 1, 2);
mm:=StrToInt(Value);
sTot :=EncodeDate(y, m, d)+EncodeTime(h, mm, 0, 0);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
//调用自定义的转换函数sTot
showMessage(datetimeToStr(sTot('200202231259')));
end;
请为LeeChange和小唐加分吧,呵呵,在此先谢过了。