From RAD Studio API Documentation
Jump to: navigation, search


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


extern DELPHI_PACKAGE System::TDateTime __fastcall RecodeTime(const System::TDateTime AValue, const System::Word AHour, const System::Word AMinute, const System::Word ASecond, const System::Word AMilliSecond);


Type Visibility Source Unit Parent
function public
System.DateUtils System.DateUtils


Selectively replaces the time parts of a specified TDateTime value.

Call RecodeTime to convert the date/time value specified by AValue with the value obtained by changing the hour to AHour, the minute to AMinute, the second to ASecond, and the milliseconds to AMilliSecond. Any one of these parameters can be set to RecodeLeaveFieldAsIs, which tells RecodeTime not change the existing portion of the TDateTime value specified in AValue.

AHour can range from 0 through 24 (or be RecodeLeaveFieldAsIs). If AHour is 24, then AMinute, ASecond, and AMilliSecond must all be 0.

AMinute can range from 0 through 59 (or be RecodeLeaveFieldAsIs).

ASecond can range from 0 through 59 (or be RecodeLeaveFieldAsIs).

AMilliSecond can range from 0 through 999 (or be RecodeLeaveFieldAsIs).

If the values provided for AHour, AMinute, ASecond, and AMilliSecond do not result in a valid time, RecodeTime raises an EConvertError exception.

See Also

Code Examples