RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
DateUtils.RecodeDateTime Function

Selectively replaces parts of a specified TDateTime value.

Pascal
function RecodeDateTime(const AValue: TDateTime; const AYear: Word; const AMonth: Word; const ADay: Word; const AHour: Word; const AMinute: Word; const ASecond: Word; const AMilliSecond: Word): TDateTime;
C++
TDateTime RecodeDateTime(const TDateTime AValue, const Word AYear, const Word AMonth, const Word ADay, const Word AHour, const Word AMinute, const Word ASecond, const Word AMilliSecond);

Call RecodeDateTime to convert the date/time value specified by AValue with the value obtained by changing the year to AYear, the month to AMonth, the day of the month to ADay, the hour to AHour, the minute to AMinute, the second to ASecond, and the millisecond to AMilliSecond. Any one of these parameters can be set to RecodeLeaveFieldAsIs which tells RecodeDateTime not change the existing portion of the TDateTime value. 

AYear can range from 1 to 9999 (or be RecodeLeaveFieldAsIs). 

AMonth can range from 1 to 12 (or be RecodeLeaveFieldAsIs). 

Legal values for ADay depend on the month represented by AMonth. (For example, if AMonth is 1, ADay can range from 1 to 31; if AMonth is 2, ADay can range from 1 to 28 or 1 to 29, depending on the year; and so on.) ADay can also be RecodeLeaveFieldAsIs

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

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

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

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

If the values do not result in a valid date and time, RecodeDateTime raises an EConvertError exception. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!