Delphi – How do I check if Variant is TDATETIME?

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

I use VarType() to check its type, but since VarType() does not have’varDate’ or’varDateTime’, I use’varDouble’ because as far as I know, TDateTime is a double.

But it will fail. I also can’t use it to check if Variant is TDateTime. Is there a way, or should I make some kind of variable to determine the type of the value and use it to check it?

Your assumption is incorrect; there is actually a varDate.

p>

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

I use VarType () to check its type, but since VarType() does not have’varDate’ or’varDateTime’, I use’varDouble’ because as far as I know, TDateTime is a double.

But this will Failed. I also can’t use to check if Variant is TDateTime. Is there a way, or should I make some kind of variable to determine the type of the value and use it to check it?

Your assumption is incorrect; there is actually a varDate.

Leave a Comment

Your email address will not be published.