IsValidDate

Check whether a set of values is a valid date indication.

Declaration

Source position: dateutil.inc line 85

  function IsValidDate(const AYear: Word; const AMonth: Word; 
                      const ADay: Word) : Boolean;

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

Name Description
IsValidDateDay Check whether a given year/day of year combination is a valid date.
IsValidDateMonthWeek Check whether a given year/month/week/day of the week combination is a valid day
IsValidDateTime Check whether a set of values is a valid date and time indication.
IsValidDateWeek Check whether a given year/week/day of the week combination is a valid day.
IsValidTime Check whether a set of values is a valid time indication.

Example

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.