The RecodeSecond function replaces the seconds for the specified TDateTime value.

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

Valid accepted values for ASecond range from 0 to 59.

If the value provided for ASecond is not within the allowable range, then RecodeSecond raises an exception error.

Declaration: Function RecodeSecond(const AValue: TDateTime; const ASecond: Word): TDateTime;

An example would be as follows.

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