Unit 'DateUtils' Package
[Overview][Constants][Classes][Procedures and functions][Index] [#rtl]

IsValidDateWeek

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

Declaration

Source position: dateutil.inc line 111

function IsValidDateWeek(

  const AYear: Word;

  const AWeekOfYear: Word;

  const ADayOfWeek: Word

):Boolean;

Arguments

AYear

  

Year.

AWeekOfYear

  

Week in the year.

ADayOfWeek

  

Day in the week.

Function result

True if the given combination is a valid date, False otherwise.

Description

IsValidDateWeek returns True if AYear, AWeekOfYear and ADayOfWeek form a valid date indication, or False otherwise.

AYear must be in the range 1..9999 to be valid.

The ADayOfWeek,ADayOfWeek values are checked to see whether the combination falls within the valid range of weeks for AYear.

See also

IsValidDate

  

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

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.

IsValidDateMonthWeek

  

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

Example

Program Example10;

{ This program demonstrates the IsValidDateWeek function }

Uses SysUtils,DateUtils;

Var
  Y,W,D : Word;
  B : Boolean;

Begin
  or:=2000 to 2004 do
    begin
    B:=True;
    or:=51 to 54 do
      or:=1 to 7 do
        If B then
          begin
          B:=IsValidDateWeek(Y,W,D);
          If Not B then
            if (D=1) then
              Writeln(Y,' has exactly ',W,' weeks.')
            else
              Writeln(Y,' has ',W,' weeks and ',D-1,' days.');
          end;
    end;
End.

Documentation generated on: Dec 10 2024