IsValidDate function
Check whether a set of values is a valid date indication.
Declaration
function IsValidDate(const AYear: Word; const AMonth: Word;
const ADay: Word): BooleanArguments
AYear | Year value. |
AMonth | Month in the year. |
ADay | Day in the month. |
Function result
True if the given values form a valid date,
False if not.Description
IsValidDate returns
True when the values
AYear,
AMonth,
ADay form a valid date indication. If one of
the values is not valid (e.g. the day is invalid or does not exist in that
particular month),
False is returned.
AYear must be in the range 1..9999 to be valid.
See also
Example: ex5
Program Example5;
{ This program demonstrates the IsValidDate function }
Uses SysUtils,DateUtils;
Var
Y,M,D : Word;
Begin
For Y:=2000 to 2004 do
For M:=1 to 12 do
For D:=1 to 31 do
If Not IsValidDate(Y,M,D) then
Writeln(D,' is not a valid day in ',Y,'/',M);
End.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
