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

# RecodeMinute

The **RecodeMinute** function replaces the minute value for the specified **TDateTime** value.

The function converts the date/time **TDateTime** value specified by **AValue**, with the value obtained by changing the minute of the hour within **AValue** to the hour specified with **AMinute**.

Valid accepted values for **AMinute** range from 0 to 59.

If the value provided for **AMinute** is not within the allowable range, then **RecodeMinute** raises an exception error.

**Declaration**: Function RecodeMinute(const AValue: TDateTime; const AMinute: Word): TDateTime;

An example would be as follows.

```pascal
procedure OnMapEvent(var Value:Variant);
var
  ThatDate : TDateTime;
begin
 //Forces the minute of the hour to 30 regardless of any other parameter
 ThatDate := RecodeMinute(Now, 30);
 LogInfo(FormatDateTime('dd-mm-yyyy hh:nn:ss.zzz', ThatDate));

end;
```
