将变体解析为 TXSDateTime
Parse Variant to TXSDateTime
我想从 Delphi 中的网络服务解析我的结果对象。现在我需要将 Variant 解析为 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;
函数现在 returns 一个 Variant
,我无法解析为 TXSDateTime
。如果我知道类型,它就会起作用,例如:
dateXSvalue := Contract(objects[i]).StartDate;
那么如何在不知道确切类型的情况下将 Variant 解析为 TXSDateTime?
变体将包含一个整数 (VarType(value) = varInteger
),它包含 TXSDateTime 实例的地址。你应该能够像这样简单地转换它:
XSDateTime := TXSDateTime(Integer(value));
我想从 Delphi 中的网络服务解析我的结果对象。现在我需要将 Variant 解析为 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;
函数现在 returns 一个 Variant
,我无法解析为 TXSDateTime
。如果我知道类型,它就会起作用,例如:
dateXSvalue := Contract(objects[i]).StartDate;
那么如何在不知道确切类型的情况下将 Variant 解析为 TXSDateTime?
变体将包含一个整数 (VarType(value) = varInteger
),它包含 TXSDateTime 实例的地址。你应该能够像这样简单地转换它:
XSDateTime := TXSDateTime(Integer(value));