用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('你可以吃了')

解决方案 »

  1.   

    我想知道那个format()函数里的参数.我要取的是时间
      

  2.   

      是一天中的某个时间段吗,是的话就
    if now()>begintime and now<endtime then //当然,里面是两个变量
    做你想做的事情;
      

  3.   

    这里指的begintime 和endtime 怎样把时间进行格式化,用到哪个函数及里面的参数
      

  4.   

    format返回的是字符串
    procedure TForm1.Button1Click(Sender: TObject);
    var
    date:string;
    begin
    Date := Format('%0.2d:%0.2d:%0.2d', [12, 2, 1]);
    //之后可用strtotime返回时间比较。
    showmessage(date);
    end;
      

  5.   

    我想在问一下wangzh,当我在进行时间比较的时候用到timetostr(now)>format(%0.2d:%0.2d:%0.2d,[09,30,00])  showmessage('此卡现在不能使用!');这样在进行时间比较的时候老是比较不出,当我把09改成12或20,就可以了,不知仁兄能否指点迷津
      

  6.   


    FormatDateTime( 'hh:nn:ss', time) > FormatDateTime( 'hh:nn:ss', EncodeTime(9, 30, 0, 0))