delphivarianttdatetime

How do I check if a Variant is a TDateTime?


I have an object, that has one value, but that value can either be an integer, string, boolean or TDateTime. So, it is a Variant.

I use VarType() to check its type, but since VarType() has no 'varDate' or 'varDateTime', I am using 'varDouble', because as far as I can gather, a TDateTime is a double.

But that returns false. I also cannot use is to check if the Variant is TDateTime. Is there a way, or should I make some sort of type variable that determines which type the value is and use that to check it?


Solution

  • Your assumptions are incorrect; there is in fact a varDate.