4

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?

Svip
  • 2,958
  • 3
  • 22
  • 33
  • Anyway, you don't need to make your own function to check a variant type. There's already the [`VarIsType`](http://docwiki.embarcadero.com/Libraries/XE2/en/System.Variants.VarIsType) function to do so. – TLama Mar 13 '13 at 14:18

1 Answers1

8

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

Andreas Rejbrand
  • 105,602
  • 8
  • 282
  • 384