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

# StartOfAYear

**StartOfAYear** returns a **TDateTime** value that represents 12:00:00:00 A.M. on the first day of a specified year, by returning the first expressible moment of the year specified by **AYear**.

**Declaration**: Function StartOfAYear( const AYear : Word) : TDateTime;

An example follows and with a processing date of 2023, the function returns 01/01/2023 00:00:00.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  TheYear : word;
  TheDate : TDateTime;
begin
 TheYear := 2023;
 TheDate := StartOfAYear(TheYear);
 LogInfo('The start of the year date is '+FormatDateTime('dd/mm/yyyy hh:nn:ss',TheDate));
end;
```

Also refer to **StartOfTheYear** for similar functionality.
