unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
DateUtils;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
I: Integer;
Today: TDateTime;
WeekNum: Integer;
DayNum: Integer;
Days: String;
begin
Today := NOW;
WeekNum := WeekOfTheYear(Today);
DayNum := DayOfWeek(Today);
Today := Now - DayNum + 1;
for I := 1 to 7 do
begin
Days := Days + FormatDateTime('DD', Today + I) + ' ';
end;
ShowMessage('本周是第' + IntToStr(WeekNum) + '周,本周包括的日期是:' + Trim(Days));
end;
end.