IsValidDateTime
Check whether a set of values is a valid date and time indication.
Declaration
Source position: dateutil.inc line 87
function IsValidDateTime(const AYear: Word; const AMonth: Word;
const ADay: Word; const AHour: Word;
const AMinute: Word; const ASecond: Word;
const AMilliSecond: Word) : Boolean;
Description
IsValidTime returns True when the values AYear, AMonth, ADay, AHour, AMinute, ASecond and AMilliSecond form a valid date and time indication. If one of the values is not valid (e.g. the seconds are larger than 60), False is returned.
AYear must be in the range 1..9999 to be valid.
See also
Name | Description |
---|---|
IsValidDate | Check whether a set of values is a valid date indication. |
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 |
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 Example7;
{ This program demonstrates the IsValidDateTime function }
Uses SysUtils,DateUtils;
Var
Y,Mo,D : Word;
H,M,S,MS : Word;
I : Integer;
Begin
For I:=1 to 10 do
begin
Y:=2000+Random(5);
Mo:=Random(15);
D:=Random(40);
H:=Random(32);
M:=Random(90);
S:=Random(90);
MS:=Random(1500);
If Not IsValidDateTime(Y,Mo,D,H,M,S,MS) then
Writeln(Y,'-',Mo,'-',D,' ',H,':',M,':',S,'.',MS,' is not a valid date/time.');
end;
End.