function DayOfWeek(Date: TDateTime): Integer;DescriptionDayOfWeek returns the day of the week of the specified date as an integer between 1 and 7, where Sunday is the first day of the week and Saturday is the seventh.
可以用 function dayofweek(date:tdatetime):integer; 这个函数 例:取今天的星期天 var today1:integer; today1:=dayofweek(date); 用DAYOFWEEK取出的数为整数(1、2、3、4、5、6、7)对应的星期为(日、一、二、三、四、五、六—)这样再写上相应的语句就可以了
procedure TForm1.Button1Click(Sender: TObject); begin Edit1.Text:=vartostr(weekoftheyear(DateTimePicker1.date)); end;
procedure TForm1.Button1Click(Sender: TObject); begin Edit1.Text:=vartostr(weekoftheyear(DateTimePicker1.date)); end; 顺便说一下,要引用Dateutils单元.
function dayofweek(date:tdatetime):integer;
这个函数
例:取今天的星期天
var
today1:integer;
today1:=dayofweek(date);
用DAYOFWEEK取出的数为整数(1、2、3、4、5、6、7)对应的星期为(日、一、二、三、四、五、六—)这样再写上相应的语句就可以了
begin
Edit1.Text:=vartostr(weekoftheyear(DateTimePicker1.date));
end;
begin
Edit1.Text:=vartostr(weekoftheyear(DateTimePicker1.date));
end;
顺便说一下,要引用Dateutils单元.
用DayOfTheWeek直接返回星期几,如果用DayOfWeek是返回一周的第几天(从周日开始算1)