M
mhtan
Unregistered / Unconfirmed
GUEST, unregistred user!
function Tyuejie_form.GetYearMonthLastDate(Year, Month: Word): TDate;
var day:Word;
begin
CASE Month of
1,3,5,7,8,10,12: day := 31;
2:
if isLeapYear(Year) then
day := 29
else
day := 28;
4,6,9,11: day := 30;
else
Raise Exception.Create('Error: Month no in [1,12]');
end;
Result := EnCodeDate(Year, Month, day);
end;
正好刚遇到这个问题,这是我的笨方法,请指教
var day:Word;
begin
CASE Month of
1,3,5,7,8,10,12: day := 31;
2:
if isLeapYear(Year) then
day := 29
else
day := 28;
4,6,9,11: day := 30;
else
Raise Exception.Create('Error: Month no in [1,12]');
end;
Result := EnCodeDate(Year, Month, day);
end;
正好刚遇到这个问题,这是我的笨方法,请指教