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

RecodeHour

Replace hours part of a TDateTimevalue with another hour.

Declaration

Source position: dateutil.inc line 338

function RecodeHour(

  const AValue: TDateTime;

  const AHour: Word

):TDateTime;

Arguments

AValue

  

Date/time to recode

AHour

  

Hour to replace in AValue

Function result

AValuewith replaced hour.

Description

RecodeHourreplaces the Hour part of the timestamp AValuewith AHour. All other parts of the date/time stamp are left untouched.

Errors

If the AHourvalue is not within a valid range (0..23) 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.

RecodeMinute

  

Replace minutse part of a TDateTimevalue with another minute.

RecodeSecond

  

Replace seconds part of a TDateTimevalue with another second.

RecodeMilliSecond

  

Replace milliseconds part of a TDateTimevalue with another millisecond.

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

{ This program demonstrates the RecodeHour function }

Uses SysUtils,DateUtils;

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

Var
  S : AnsiString;

Begin
  S:=FormatDateTime(Fmt,RecodeHour(Now,0));
  Writeln('Today, in the first hour : ',S);
End.