IsValidDate
IsValidDate returns True if the given date parts would return a valid date.
AYear must be within the range of 1 through 9999 inclusive.
AMonth must be within the range of 1 through 12 inclusive.
ADay must fall within the range of 1 through to 31 - depending on the total number of days in AMonth.
If any one of these three (3) parameter range constraints is not met, then IsValidDate returns False.
This function is useful for testing date parts prior to passing them to the EncodeDateTime function.
Declaration: function IsValidDate(const AYear: Word; const AMonth: Word; const ADay: Word): Boolean;
An example of its use follows.
procedure
OnMapEvent(
var
Value:Variant);
var
vReal, vReal2 ;
boolean
;
begin
//Returns true if the given date parts would create a valid date
vReal := IsValidDate(
2009
,
06
,
25
);
//VALID
if
vReal =
True
then
loginfo(
'vReal date is valid.'
)
else
LogInfo(
'vReal date is not valid.'
);
vReal2 := IsValidDate(
2024
,
02
,
30
);
//INVALID
if
vReal2 =
True
then
loginfo(
'vReal2 date is valid.'
)
else
LogInfo(
'vReal2 date is not valid.'
);
LogInfo(
''
);
end
;