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

RecodeDate

Replace date part of a TDateTimevalue with another date.

Declaration

Source position: dateutil.inc line 342

function RecodeDate(

  const AValue: TDateTime;

  const AYear: Word;

  const AMonth: Word;

  const ADay: Word

):TDateTime;

Arguments

AValue

  

Date/time to recode

AYear

  

Year to replace in AValue

AMonth

  

Month to replace in AValue

ADay

  

Day to replace in AValue

Function result

AValuewith replaced date.

Description

RecodeDatereplaces the date part of the timestamp AValuewith the date specified in AYear, AMonth, ADay. All other parts (the time part) of the date/time stamp are left untouched.

Errors

If one of the AYear, AMonth, ADayvalues is not within a valid range then an EConvertErrorexception is raised.

See also

RecodeYear

  

Replace year part of a TDateTimevalue with another year.

RecodeMonth

  

Replace month part of a TDateTimevalue with another month.

RecodeDay

  

Replace day part of a TDateTimevalue with another day.

RecodeHour

  

Replace hours part of a TDateTimevalue with another hour.

RecodeMinute

  

Replace minutse part of a TDateTimevalue with another minute.

RecodeSecond

  

Replace seconds part of a TDateTimevalue with another second.

RecodeDate

  

Replace date part of a TDateTimevalue with another date.

RecodeTime

  

Replace time part of a TDateTimevalue with another time.

RecodeDateTime

  

Replace selected parts of a TDateTimevalue with other values

Example

Program Example94;

{ This program demonstrates the RecodeDate function }

Uses SysUtils,DateUtils;

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

Var
  S : AnsiString;

Begin
  S:=FormatDateTime(Fmt,RecodeDate(Now,2001,1,1));
  Writeln('This moment on the first of the millenium : ',S);
End.