Function declaration:
/ / Based on Value Year:
totalday function (const t: Word): Integer;
begin
if IsLeapYear (t) then Result: = 366
else Result: = 365;
end;
/ / Based on Date:
totalday Date function (const d: TDate): Integer;
var
tg, bl, th: Word;
begin
DecodeDate (d, th, bl, tg);
Result: = totalday (th);
end;
Example of implementation:
procedure TForm1.Button1Click (Sender: TObject);
begin
Edit1.Text: = IntToStr (totalday (2010));
{When Using Date Time Picker
Edit1.Text: = IntToStr (totalday Date (DateTimePicker1.Date));}
end;
No comments:
Post a Comment