Seems there is no way to assign NULL (either an "unassigned value" to TDateTime
variables.
The only way I've imagined is using something like this:
function isNull(aDate : TDateTime) : boolean;
const NullDate = 0.0;
var aNullDate : TDatetime;
ms : Int64;
begin
aNullDate := NullDate;
ms := MilliSecondsBetween(aDate,aNullDate);
result := (ms = Int64(0));
end;
Is there anybody out who knows better solution what not overlaps 0 date value?
Are negative TDateTime
values dangerous? (As an able resource for previous purpose)
As Andreas already wrote, the TDateTime
type is actually double
and thus not "nullable". I use
const
c_UnassignedDate = -693594;
for a empty date value as this represents an impossible date of 00/00/0000
. But for example DevExpress uses
NullDate = -700000;
InvalidDate = NullDate + 1;
So there seems to be no agreed upon standard vale, you should pick one which suits your need.