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

# DayOf (DayOfTheMonth)

The **DayOf** function returns the day number of the month represented by the given date value. The resulting day number is a number between 1 and 31.

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

Function DayOfTheMonth(const AValue: TDateTime): Word;

An example follows.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  TheDay, TheMthDay : word;
begin
 //If the date is 2023-11-30 then the result is 30
  TheDay := DayOf(Date);
  LogInfo('The DAYOF is '+IntToStr(TheDay));

 //If the date is 2023-11-29 then the result is 29
  TheMthDay := DayOfTheMonth(Yesterday);
  LogInfo('The DAYOFTHEMONTH is '+IntToStr(TheMthDay));
end;
```

**DayOf** has the same functionality as the **DayOfTheMonth** function.
