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

# RecodeTime

Replace time part of a TDateTime value with another time.

## Declaration

Source position: dateutil.inc line 352

`function RecodeTime(`
`const AValue: TDateTime;`
`const AHour: Word;`
`const AMinute: Word;`
`const ASecond: Word;`
`const AMilliSecond: Word`
`):TDateTime;`

## Arguments

`AValue` |  | Date/time to recode
`AHour` |  | Hour to replace in AValue
`AMinute` |  | Minute to replace in AValue
`ASecond` |  | Second to replace in AValue
`AMilliSecond` |  | Millisecond to replace in AValue

## Function result

AValue with replaced time.

## Description

RecodeTime replaces the time part of the timestamp AValue with the date specified in AHour, AMinute, ASecond and AMilliSecond. All other parts (the date part) of the date/time stamp are left untouched.

## Errors

If one of the values AHour, AMinute, ASecondAMilliSecond is not within a valid range then an EConvertError exception is raised.

## See also

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 minutse 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.
RecodeDateTime |  | Replace selected parts of a TDateTime value with other values

## Example

    Program Example95;

    { This program demonstrates the RecodeTime function }

    Uses SysUtils,DateUtils;

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

    Var
      S : AnsiString;

    Begin
      S:=FormatDateTime(Fmt,RecodeTime(Now,8,0,0,0));
      Writeln('Today, 8 AM : ',S);
    End.

Documentation generated on: Feb 26 2014