我该如何将TValue转换为TDateTime?
我看到有像AsInteger、AsDouble等方法,但没有针对TDateTime的方法。
var
c : TRttiContext;
t : TRttiType;
f : TRttiField;
fieldValue : TValue;
fieldDateValue : TDateTime;
begin
c := TRttiContext.Create;
t := c.GetType(Self.ClassType);
for f in t.GetFields do begin
fieldValue := field.GetValue(Self);
//convert the TValue in TDateTime
end;
end;
fieldValue.AsType<TDateTime>
- TLamadelphi
标签已经让大家知道你的问题是关于Delphi的,不需要在各个地方重复添加。标签在这里非常有效,既可以让能够回答问题的人看到你的问题,也可以正确分类以便搜索;它不需要重复的帮助。:-) 谢谢。 - Ken White