Gelegentlich hilft auch ein Blick in die Delphi Hilfe.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
ADate: TDateTime;
days: array [1..7] of string;
begin
ADate:= StrToDate('1.1.2011');
days[1]:= 'Sunday';
days[2]:= 'Monday';
days[3]:= 'Tuesday';
days[4]:= 'Wednesday';
days[5]:= 'Thursday';
days[6]:= 'Friday';
days[7]:= 'Saturday';
while CompareDate (Adate, Now) <= 0 do
// oder while not IsSameDay (Adate, IncDay(Now)) do
// oder while not IsToday (IncDay(ADate, -1)) do
begin
// ListBox1.Items.Add(DateToStr(ADate) + ' is a ' + days[DayOfWeek(ADate)]);
if DayOfWeek(ADate) = 6 then
ListBox1.Items.Add(DateToStr(ADate) + ' ist ein Freitag');
ADate:= IncDay(ADate);
end;
end;