Reputation: 180
In firebird 3.0 db in Timestamp type field saved data. How compare this data to current date?
if (Query1data1.AsDateTime <>date()) then ...
Upvotes: 0
Views: 1238
Reputation: 2755
If you want to ignore the time of day, may use CompareDate.
Indicates the relationship between the date portions of two TDateTime values.
Call CompareDate to compare the two TDateTime values specified by A and B. CompareDate returns:
LessThanValue if A occurs on a day prior to the day specified by B. EqualsValue if A occurs on the same day as B, ignoring the time of day. GreaterThanValue if A occurs on a day that follows the day specified by B.
For example :
case CompareDate(Query1data1.FieldByName('TIMESTAMP_FIELD').AsDateTime,Date()) of
-1 : ShowMessage('is less');
0 : ShowMessage('equals');
1 : ShowMessage('is greater')
end;
Also you may use: DateOf
Strips the time portion from a TDateTime value.
Call DateOf to convert a TDateTime value to a TDateTime value that includes only the date information (sets the time portion to 0, which means midnight).
if DateOf(Query1data1.FieldByName('FTIMESTAMP').AsDateTime) = Date() then
....
Upvotes: 1