I need know type variable TDateTime, TDate and TTime.
Anyone have any idea how to do this?
I used the code below, the result is "Is NOT TDateTime", "Is NOT TDate", "Is NOT Ttime"
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.Rtti,
System.SysUtils;
var
DateTime, Date,Time: TValue;
begin
DateTime:= StrToDateTime( '01/01/2013 01:05:09' );
if ( DateTime.TypeInfo = System.TypeInfo(TDateTime) ) then
Writeln( 'Is TDateTime' )
else
Writeln( 'Is NOT TDateTime' );
Date:= StrToDate( '01/01/2015' );
if ( Date.TypeInfo = System.TypeInfo(TDate) ) then
Writeln( 'Is TDate' )
else
Writeln( 'Is NOT TDate' );
Time:= StrToTime( '01:01:02' );
if ( Date.TypeInfo = System.TypeInfo(TTime) ) then
Writeln( 'Is TTime' )
else
Writeln( 'Is NOT TTime' );
Readln;
end.
Thanks
from here
. – NitpickingTDateTime
, always. – DevoirExtended
always - see my answer below. – Edington