[Overview][Constants][Procedures and functions][Index] Reference for unit 'DateUtils' (#rtl)

RecodeMonth

Replace month part of a TDateTime value with another month.

Declaration

Source position: dateutil.inc line 346

function RecodeMonth(

  const AValue: TDateTime;

  const AMonth: Word

):TDateTime;

Arguments

AValue

  

Date to recode

AMonth

  

Month to replace in AValue

Function result

AValue with replaced month.

Description

RecodeMonth replaces the Month part of the timestamp AValue with AMonth. All other parts of the date/time stamp are left untouched.

Errors

If the AMonth value is not within a valid range (1..12) then an EConvertError exception is raised.

See also

RecodeYear

  

Replace year part of a TDateTime value with another year.

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.

RecodeSecond

  

Replace seconds part of a TDateTime value with another second.

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 Example88;

{ This program demonstrates the RecodeMonth function }

Uses SysUtils,DateUtils;

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

Var
  S : AnsiString;

Begin
  S:=FormatDateTime(Fmt,RecodeMonth(Now,5));
  Writeln('This moment in May : ',S);
End.

Documentation generated on: Jun 22 2020