两个函数就搞定了 Returns the week of the year represented by a TDateTime value.Unit DateUtilsfunction WeekOfTheYear(const AValue: TDateTime): Word; overload; function WeekOfTheYear(const AValue: TDateTime; var AYear): Word; overload; //////////////////////////////////////////////////////////// Returns the day of the week represented by a TDateTime value.Unit DateUtilsfunction DayOfTheWeek(const AValue: TDateTime): Word;
WeekOf() //求出第几个礼拜 DayOfTheWeek() //求出星期几
uses DateUtils procedure TForm1.Button1Click(Sender: TObject); var s: string; begin s := inttostr(WeekOftheyear(DateTimePicker1.Date)); s := inttostr(yearof(DateTimePicker1.Date)) + '/第' + s + '个礼拜/星期' + inttostr(DayOfTheWeek(DateTimePicker1.Date)); showmessage(s); end;
Returns the week of the year represented by a TDateTime value.Unit
DateUtilsfunction WeekOfTheYear(const AValue: TDateTime): Word; overload;
function WeekOfTheYear(const AValue: TDateTime; var AYear): Word; overload;
////////////////////////////////////////////////////////////
Returns the day of the week represented by a TDateTime value.Unit
DateUtilsfunction DayOfTheWeek(const AValue: TDateTime): Word;
DayOfTheWeek() //求出星期几
procedure TForm1.Button1Click(Sender: TObject);
var
s: string;
begin
s := inttostr(WeekOftheyear(DateTimePicker1.Date));
s := inttostr(yearof(DateTimePicker1.Date)) + '/第' + s + '个礼拜/星期' + inttostr(DayOfTheWeek(DateTimePicker1.Date));
showmessage(s);
end;