Delphi 将变量解析为TXSDateTime

Delphi 将变量解析为TXSDateTime,delphi,delphi-xe2,variant,Delphi,Delphi Xe2,Variant,我想在Delphi中解析来自webservice的结果对象。现在我需要解析TXSDateTime的一个变量,因为我不知道它的类型。例如: if propInfo.PropType^ = TypeInfo(TXSDateTime) then begin value := GetPropValue(objects[i], propInfo); //only returns a Variant dateXSvalue := ???; //need to parse value to d

我想在Delphi中解析来自webservice的结果对象。现在我需要解析
TXSDateTime
的一个变量,因为我不知道它的类型。例如:

if propInfo.PropType^ = TypeInfo(TXSDateTime) then
begin
    value := GetPropValue(objects[i], propInfo); //only returns a Variant
    dateXSvalue := ???; //need to parse value to dateXSvalue;
end;
该函数现在返回一个我无法解析为
TXSDateTime
变量。如果我知道类型,它会起作用,例如:

dateXSvalue := Contract(objects[i]).StartDate;

那么,如何在不知道确切类型的情况下将变量解析为TXSDateTime呢?

该变量将包含一个整数(
VarType(value)=varInteger
),该整数保存TXSDateTime实例的地址。您应该能够像这样简单地进行施放:

XSDateTime := TXSDateTime(Integer(value));

VarType(value)
提供了什么?它很可能是指向TXDDateTime实例的指针。@GolezTrol它返回33=
varInteger
(单位制,如VarType上的文档所引用)。可能确实是一个指针。您能试试
TXSDateTime(Integer(value))
看看它能为您做些什么吗?@GolezTrol非常感谢!它是这样工作的!请把它作为答案贴出来,这样我就可以接受了。