RecodeTime function
Replace time part of a
TDateTime value with another time.
Declaration
function RecodeTime(const AValue: TDateTime; const AHour: Word;
const AMinute: Word; const ASecond: Word;
const AMilliSecond: Word): TDateTimeArguments
AValue | Date/time to recode. |
AHour | Hour to replace in
|
AMinute | Minute to replace in
|
ASecond | Second to replace in
|
AMilliSecond | Millisecond to replace in
|
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,
ASecond
AMilliSecond is not within a valid range then an
EConvertError
exception is raised.
See also
- RecodeYear
- RecodeMonth
- RecodeDay
- RecodeHour
- RecodeMinute
- RecodeSecond
- RecodeMilliSecond
- RecodeDate
- RecodeDateTime
Example: ex95
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.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
