1
我想在Delphi中解析webservice中的结果对象。现在我需要解析一个变体到TXSDateTime
,因为我不知道类型。例如:Parse Variant to 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;
函数现在返回一个Variant
,我不能解析到TXSDateTime
。它会工作,如果我知道是什么类型,因此,例如:
dateXSvalue := Contract(objects[i]).StartDate;
那么怎么可能解析的Variant到TXSDateTime不知道确切的类型?
'VarType(value)'给了你什么?这可能是一个指向TXDDateTime实例的指针。 – GolezTrol
@GolezTrol返回3 –
3 ='varInteger'(单元系统,参考VarType文档)。确实可以是一个指针。你可以尝试'TXSDateTime(Integer(value))'看看它为你做了什么? – GolezTrol