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

# MilliSecondOfTheYear

A similar function to **SecondOfTheYear**, the function **MilliSecondOfTheYear** returns the number of complete milliseconds between the **TDateTime** value entered as **AValue**, and 12:00 A.M. of the first day of the year that includes **AValue**.

It can be an extremely large number.

**Declaration**: Function MilliSecondOfTheYear(const AValue: TDateTime): Int64;

A simple example follows.

```pascal
procedure ScriptEvent (var Value : variant);
var
  ThoseMils : Int64;
begin
 //YESTERDAY is 28-11-2023, so the result is 28598400000
  ThoseMils := MilliSecondOfTheYear(Yesterday);
  LogInfo('The number of MILLISECONDS since 1st Jan are '+IntToStr(ThoseMils));
end;
```
