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

# MilliSecondOfTheMonth

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

This may be a very large number.

**Declaration**: Function MilliSecondOfTheMonth(const AValue: TDateTime): Cardinal;

A simple example follows.

```pascal
procedure ScriptEvent (var Value : variant);
var
  TheSec : cardinal;
begin
 //If YESTERDAY is 29-11-2023, the result is 2419200000
  TheSec := MilliSecondOfTheMonth(Yesterday);
  LogInfo('The number of milliseconds since 1st Nov 23 is '+IntToStr(TheSec));
end;
```
