请问哪位大侠在delphi中如果知道具体日期,有没有什么函数可以得到星期几?
解决方案 »
- 放个分先,谢谢支持,祝大家节日快了
- 一个com+ & 线程的问题
- socket 受不到数据
- 开一个线程,CPU 占用率居然100%??????????
- 简单问题,如何屏蔽窗体右上角的关闭按纽。
- 高手们,谁能帮我解决随机函数的问题阿??
- 怎么实现用鼠标左键点击Speedbutton出现PopupMenu(注意我要左键不要右键)
- 日记帐中间一笔记录,删除以后余额变动问题?
- 新手问题:请问如何从Access导入Mssql,请给个思路,谢谢!
- 各位大侠,怎样能使DATETIMEPICKER 控件显示数据库中某字段的日期--一定加分头颅保证
- delphi中用什么函数可以知道某一天是星期几?
- 给出一个日期,如何判断其为星期天和星期六.有类似的函数吗?急用!!!100分!!!
ADate: TDateTime;
days: array[1..7] of string;
begin
days[1] := 'Sunday';
days[2] := 'Monday';
days[3] := 'Tuesday';
days[4] := 'Wednesday';
days[5] := 'Thursday';
days[6] := 'Friday';
days[7] := 'Saturday';
ADate := StrToDate(Edit1.Text);
ShowMessage(Edit1.Text + ' is a ' + days[DayOfWeek(ADate)];
end;
另外注意Edit1.Text中的输入格式,比如2001-11-11是合法的
Returns the day of the week represented by a TDateTime value.UnitDateUtilsCategorydate/time routinesfunction DayOfTheWeek(const AValue: TDateTime): Word;DescriptionCall DayOfTheWeek to obtain the day of the week represented by a specified TDateTime value. DayOfTheWeek returns a value between 1 and 7, where 1 indicates Monday and 7 indicates Sunday.
ADate: TDateTime;
begin
ADate := StrToDate(Edit1.Text);
edit1.text:=inttostr(DayOfWeek(ADate)-1);
end;
另外注意Edit1.Text中的输入格式,比如2001-11-11是合法的,
显示0 为星期天 1为星期一 2为星期二 …… 6为星期六
呵呵,偶有个万年历的程序,有阴历和阳历的显示
要请发MESSAGE给我!
ADate: TDateTime;
days: array[1..7] of string;
begin
days[1] := 'Sunday';
days[2] := 'Monday';
days[3] := 'Tuesday';
days[4] := 'Wednesday';
days[5] := 'Thursday';
days[6] := 'Friday';
days[7] := 'Saturday';
ADate := StrToDate(Edit1.Text);
ShowMessage(Edit1.Text + ' is a ' + days[DayOfWeek(ADate)];
end;
DateUtilsWeekOfTheMonth()
function WeekOfTheMonth(const AValue: TDateTime)
Call WeekOfTheMonth to obtain the week of the month represented by a specified TDateTime value. WeekOfTheMonth returns a value between 1 and 6.
3 'Monday';
4 'Tuesday';
5 'Wednesday';
6 'Thursday';
7 'Friday';
1 'Saturday';
1: Edit1.text:='星期天';
2:Edit1.text:='星期一';
3:Edit1.text:='星期二';
4:Edit1.text:='星期三';
5:Edit1.text:='星期四';
6:Edit1.text:='星期五';
7:Edit1.text:='星期六';
end;