[Overview][Constants][Procedures and functions][Index] Reference for unit 'DateUtils' (#rtl)

IsValidDate

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

Declaration

Source position: dateutil.inc line 98

function IsValidDate(

  const AYear: Word;

  const AMonth: Word;

  const ADay: Word

):Boolean;

Arguments

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

IsValidTime

  

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

IsValidDateTime

  

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

IsValidDateDay

  

Check whether a given year/day of year combination is a valid date.

IsValidDateWeek

  

Check whether a given year/week/day of the week combination is a valid day.

IsValidDateMonthWeek

  

Check whether a given year/month/week/day of the week combination is a valid day

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.

Documentation generated on: May 14 2021