用now这个函数,例如:timetostr(now),datetimetostr(now)
程序中参考这么写用if..esle if else if或自已定义枚举后用case:
function oktoeat(aname:枚举类型):boolean;
begin
result:=false;case aname of
firstgroup:
begin
if 时间>1点 and 时间<2点 then
result:=True;end;
.......
识别过程:当某组插卡时给他个当前的枚举类型变量例如:currentname:=firstgroup;
procedure yes(aname:枚举类型);
if oktoeat(aname) then
showmessage('你可以吃了')
程序中参考这么写用if..esle if else if或自已定义枚举后用case:
function oktoeat(aname:枚举类型):boolean;
begin
result:=false;case aname of
firstgroup:
begin
if 时间>1点 and 时间<2点 then
result:=True;end;
.......
识别过程:当某组插卡时给他个当前的枚举类型变量例如:currentname:=firstgroup;
procedure yes(aname:枚举类型);
if oktoeat(aname) then
showmessage('你可以吃了')
if now()>begintime and now<endtime then //当然,里面是两个变量
做你想做的事情;
procedure TForm1.Button1Click(Sender: TObject);
var
date:string;
begin
Date := Format('%0.2d:%0.2d:%0.2d', [12, 2, 1]);
//之后可用strtotime返回时间比较。
showmessage(date);
end;
FormatDateTime( 'hh:nn:ss', time) > FormatDateTime( 'hh:nn:ss', EncodeTime(9, 30, 0, 0))