System.SysUtils.TryEncodeDate
Delphi
function TryEncodeDate(Year, Month, Day: Word; out Date: TDateTime): Boolean;
C++
extern DELPHI_PACKAGE bool __fastcall TryEncodeDate(System::Word Year, System::Word Month, System::Word Day, /* out */ System::TDateTime &Date);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
Creates a TDateTime value that represents a specified Year, Month, and Day.
TryEncodeDate generates a TDateTime value from the values specified as the Year, Month, and Day parameters.
The year must be from 1 through 9999.
Valid Month values are from 1 through 12.
Valid Day values are from 1 through 28, 29, 30, or 31, depending on the Month value. For example, the possible Day values for month 2 (February) are from 1 through 28 or from 1 through 29, depending on whether the Year value specifies a leap year.
The Date parameter returns the generated value if TryEncodeDate returns True.
If the specified values are not within range, TryEncodeDate returns False.