Forum > Other

How can I know if my property is of TDateTime type in r-time

(1/1)

p_evghenii:
This code works pretty good in Delphi, but not in Lazarus:

if GetPropInfo(self, PropName).PropType^ = TypeInfo(TDateTime) then

Anonymous:
I think you should try the following code, but I'm not sure it's the one you want:

if (self is TDateTime) then

p_evghenii:
No, this code is not the one I need.

I have a number of properties of my object (self). I want to determine the type of my properties. It is easy to determine integers, strings etc. But there is no special method in typinfo to determine whether my property is TDateTime - I can find out that it is double (which in fact the TDateTime is) but I don't know whether it is double or TDateTime.

Navigation

[0] Message Index

Go to full version