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

# SecondOfTheYear

A similar function to **MinuteOfTheYear**, the function **SecondOfTheYear** returns the number of complete seconds 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 a very large number.

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

A simple example follows.

```pascal
procedure ScriptEvent (var Value : variant);
var
  ThoseSecs : cardinal;
begin
 //YESTERDAY is 28-11-2023, so the result is 28598400
  ThoseSecs := SecondOfTheYear(Yesterday);
  LogInfo('The number of minutes since 1st Jan are '+IntToStr(ThoseSecs));
end;
```
