---
url: >-
  /statelake/scripting-reference/functions-and-procedures/datetime-functions/minuteoftheweek.md
---

# MinuteOfTheWeek

**MinuteOfTheWeek** returns the number of minutes between the **TDateTime** value entered as **AValue**, and 12:00 A.M. of the first day of the week that is specified by **AValue**.

**MinuteOfTheWeek** defines the week of **AValue** according to the ISO 8601 standard, where the week starts on Monday and ends on Sunday.

**Declaration**: Function MinuteOfTheWeek(const AValue: TDateTime): Word;

A simple example follows.

```pascal
procedure ScriptEvent (var Value : variant);
var
  TheHour : word;
  TheDate : TDateTime;
begin
 //The result is 865
  TheDate := EncodeDateTime(2023, 11, 27, 14, 25, 15, 650);
  TheHour := MinuteOfTheWeek(TheDate);
  LogInfo('The number of minutes since the beginning of the week is '+IntToStr(TheHour));

 //The result is 5125
  TheDate := EncodeDateTime(2023, 11, 30, 13, 25, 15, 650);
  TheHour := MinuteOfTheWeek(TheDate);
  LogInfo('The number of minutes since the beginning of the week is '+IntToStr(TheHour));
end;
```
