Appearance
StartOfAWeek
StartOfAWeek returns a TDateTime value that represents 12:00:00:00 A.M. on a specified day of a specified week.
- The AYear parameter specifies the year of the desired day.
- The AWeekOfYear parameter specifies the week of the year, where 1 is the first week in AYear that includes four or more days.
- The ADayOfWeek parameter indicates the desired day in the specified week, where 1 is Monday, 2 is Tuesday, and so on.
The definitions for AWeekOfYear and ADayOfWeek follow the ISO 8601 standard.
If a valid date is not specified, StartOfAWeek raises an exception error EConvertError.
Declaration: Function StartOfAWeek(const AYear, AWeekOfYear, ADayOfWeek: Word) TDateTime;
An example follows.
pascal
procedure OnMapEvent(var Value:Variant);
var
TheYear, TheWeek, TheDay : word;
TheDate : TDateTime;
begin
TheYear := 2023;
TheWeek := 48;
TheDay := 3;
TheDate := StartOfAWeek(TheYear, TheWeek, TheDay);
//Returns The start of the week date is 29/11/2023 00:00:00
LogInfo('The start of the week date is '+FormatDateTime('dd/mm/yyyy hh:nn:ss',TheDate));
end;
