System.DateUtils.RecodeDateTime
Delphi
function RecodeDateTime(const AValue: TDateTime; const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word): TDateTime;
C++
extern DELPHI_PACKAGE System::TDateTime __fastcall RecodeDateTime(const System::TDateTime AValue, const System::Word AYear, const System::Word AMonth, const System::Word ADay, const System::Word AHour, const System::Word AMinute, const System::Word ASecond, const System::Word AMilliSecond);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.DateUtils.pas System.DateUtils.hpp |
System.DateUtils | System.DateUtils |
Description
Selectively replaces parts of a specified TDateTime value.
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 specified in AValue
.
AYear
can range from 1 through 9999 (or be RecodeLeaveFieldAsIs).
AMonth
can range from 1 through 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 through 31, if AMonth
is 2, ADay
can range from 1 through 28 or 1 to 29, depending on the year, and so on.) ADay
can also be RecodeLeaveFieldAsIs.
AHour
can range from 0 through 23 (or be RecodeLeaveFieldAsIs).
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 do not result in a valid date and time, RecodeDateTime raises an EConvertError exception.
See Also
- System.TDateTime
- System.SysUtils.ReplaceDate
- System.DateUtils.RecodeTime
- System.DateUtils.RecodeDate
- System.SysUtils.ReplaceTime
- System.DateUtils.EncodeDateTime
- System.DateUtils.TryRecodeDateTime
- System.SysUtils.EConvertError
- Date and Time Support