[Overview][Constants][Procedures and functions][Index] |
Check whether a set of values is a valid date and time indication.
Source position: dateutil.inc line 100
function IsValidDateTime( |
const AYear: Word; |
const AMonth: Word; |
const ADay: Word; |
const AHour: Word; |
const AMinute: Word; |
const ASecond: Word; |
const AMilliSecond: Word |
):Boolean; |
AYear |
|
Year value |
AMonth |
|
Month in the year |
ADay |
|
Day in the month |
AHour |
|
Hour of the day |
AMinute |
|
Minute in the hour |
ASecond |
|
Second in the minute |
AMilliSecond |
|
Milliseconds in the second |
True if the given values form a valid date/time pair, False if not.
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.
|
Check whether a set of values is a valid date indication. |
|
|
Check whether a set of values is a valid time indication. |
|
|
Check whether a given year/day of year combination is a valid date. |
|
|
Check whether a given year/week/day of the week combination is a valid day. |
|
|
Check whether a given year/month/week/day of the week combination is a valid day |
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.