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

# DaysInAYear

**DaysInAYear** returns the number of days in the year of the value specified by **AYear**.

**AYear** accepts values within the range of 1 to 9999 inclusive.

**Declaration**: Function DaysInAYear(const AYear: Word): Word;

An example follows.

```pascal
procedure ScriptEvent(var Value:Variant);
var
  TheYear, NumDays : word;
begin
  TheYear := 2024;
  NumDays := DaysInAYear(TheYear);
  LogInfo('Number of days in the year - '+IntToStr(NumDays));

  NumDays := DaysInAYear(TheYear+1);
  LogInfo('Number of days in the year - '+IntToStr(NumDays));

  LogInfo('');
end;
```
