var
MyDate: TDateTime;
begin
MyDate := EncodeDate(StrToInt(Edit1.Text), StrToInt(Edit2.Text), StrToInt(Edit3.Text));
Label1.Caption := DateToStr(MyDate);
end;
시간까지 표현하려면 다음함수를 조회
function EncodeDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word):TDateTime;
Description
EncodeDate returns a TDateTime value from the values specified as the AYear, AMonth, ADay, AHour, AMinute, ASecond, and AMilliSecond parameters.
The year must be between 1 and 9999.
Valid month values are 1 through 12.
Valid day values are 1 through 28, 29, 30, or 31, depending on the month value. For example, the possible day values for month 2 (February) are 1 through 28 or 1 through 29, depending on whether or not the year value specifies a leap year.
Valid hour values are 0 through 24. (If the specified hour is 24, the minute, second, and millisecond values should all be 0, and the resulting TDateTime value represents midnight at the end of the specified day and the beginning of the next day).
Valid minute values are 0 through 59.
Valid second values are 0 through 59.
Valid millisecond values are 0 through 999.
If the specified values are not within range, EncodeDateTime raises an EConvertError exception.
입력 데이터에는 1월이라는 정보가 없는데 어찌 1월인줄 아나요? ㅋㅋ
EncodeDate(년도숫자, 월숫자, 일숫자) --> 날짜형으로 리턴...
델파이 헬프에 보면 다음과 같습니다.
procedure TForm1.Button1Click(Sender: TObject);
var
MyDate: TDateTime;
begin
MyDate := EncodeDate(StrToInt(Edit1.Text), StrToInt(Edit2.Text), StrToInt(Edit3.Text));
Label1.Caption := DateToStr(MyDate);
end;
시간까지 표현하려면 다음함수를 조회
function EncodeDateTime(const AYear, AMonth, ADay, AHour, AMinute, ASecond, AMilliSecond: Word):TDateTime;
Description
EncodeDate returns a TDateTime value from the values specified as the AYear, AMonth, ADay, AHour, AMinute, ASecond, and AMilliSecond parameters.
The year must be between 1 and 9999.
Valid month values are 1 through 12.
Valid day values are 1 through 28, 29, 30, or 31, depending on the month value. For example, the possible day values for month 2 (February) are 1 through 28 or 1 through 29, depending on whether or not the year value specifies a leap year.
Valid hour values are 0 through 24. (If the specified hour is 24, the minute, second, and millisecond values should all be 0, and the resulting TDateTime value represents midnight at the end of the specified day and the beginning of the next day).
Valid minute values are 0 through 59.
Valid second values are 0 through 59.
Valid millisecond values are 0 through 999.
If the specified values are not within range, EncodeDateTime raises an EConvertError exception.