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

# EndOfTheDay

The function **EndOfTheDay** returns a **TDateTime** value that represents the last expressible millisecond moment of the day specified by **AValue**.

The time portion of **AValue** is replaced by 23:59:59:999.

**Declaration**: Function EndOfTheDay(const AValue: TDateTime): TDateTime;

The example follows.

```pascal
procedure ScriptEvent(var Value:Variant);
var
  TheDate ; TDateTime;
begin
  TheDate := EndOfTheDay(Date);
  LogInfo('The end of the day date is '+FormatDateTime('dd/mm/yyyy hh:nn:ss',TheDate));
end;
```
