Skip to content

RecodeSecond

Replace seconds part of a TDateTime value with another second.

Declaration

Source position: dateutil.inc line 383

function RecodeSecond(const AValue: TDateTime; const ASecond: Word)
                      : TDateTime;

Arguments

Name Description
AValue Date/time to recode.
ASecond Second to replace in AValue.

Function result

AValue with replaced second.

Description

RecodeSecond replaces the Second part of the timestamp AValue with ASecond. All other parts of the date/time stamp are left untouched.

Errors

If the ASecond value is not within a valid range (0..59) then an EConvertError exception is raised.

See also

Name Description
RecodeYear Replace year part of a TDateTime value with another year.
RecodeMonth Replace month part of a TDateTime value with another month.
RecodeDay Replace day part of a TDateTime value with another day.
RecodeHour Replace hours part of a TDateTime value with another hour.
RecodeMinute Replace minutes part of a TDateTime value with another minute.
RecodeMilliSecond Replace milliseconds part of a TDateTime value with another millisecond.
RecodeDate Replace date part of a TDateTime value with another date.
RecodeTime Replace time part of a TDateTime value with another time.
RecodeDateTime Replace selected parts of a TDateTime value with other values.

Example

Program Example92;

{ This program demonstrates the RecodeSecond function }

Uses SysUtils,DateUtils;

Const
  Fmt = 'dddd dd mmmm yyyy hh:nn:ss';

Var
  S : AnsiString;

Begin
  S:=FormatDateTime(Fmt,RecodeSecond(Now,0));
  Writeln('This moment, seconds stripped : ',S);
End.