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

# DecodeDateDay

**DecodeDateDay** disassembles the date **AValue**, and returns the date broken into its various component parts.

The parameters **AYear** and **ADayOfYear** are populated with the parts of the date, so that you can then use the individual variables in your calculations.

This is the opposite of **EncodeDateDay** [EncodeDateDay](/statelake/scripting-reference/functions-and-procedures/datetime-functions/encodedateday).

* **AValue** is the **TDateTime** value that is to have the information extracted from.
* **AYear** returns the year that **AValue** represents.
* **ADayOfYear** returns the day within **AYear** that **AValue** represents, where 1st January is day 1, 2nd January is day 2, 1st February is day 32 e.t.c.

**Declaration**: Procedure DecodeDateDay(const AValue: TDateTime; out AYear, ADayOfYear: Word);

Such as the example below.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  aYear, aDay : word;
begin
 //Break date/time into its individual parts
  DecodeDateDay(Now, aYear, aDay);

 if ((aYear = 2024) and (aDay = 304)) then

    ...do something at this special time...;

end;
```
