事实上,如果现在是晚上9点多,即21:30:00 作为字符‘2’<‘8’
所以timetostr(now())<'8:20:00' 
正确的应该是
if timetostr(now())<'8:20:00' then
showmessage('测试通过');

解决方案 »

  1.   

    if timetostr(now())>'20:20:00' then
    showmessage('测试通过');
      

  2.   

    if FormatDateTime('HH:NN:SS', now())>'08:20:00' then
    showmessage('测试通过');
      

  3.   

    我做了个判断时间的程序,根据不同的时间段来做不同的事,怎么写?8:20~12:20  做A事情
    12:21~19:20 做b事情
    19:21~23:00 做c事情
    23:01~第2天8:19 做d事情这应该怎么写???
      

  4.   

    if time()<strtotime('10:20:00') then
       showmessage('测试通过');
    试一试,朋友
      

  5.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      S: string;
    begin
      S := FormatDateTime('HH:NN', Now);
      if (S >= '08:20') and (S <= '12:20') then
        ShowMessage('a')
      else if (S >= '12:21') and (S <= '19:20') then
        ShowMessage('b')
      else if (S >= '19:21') and (S <= '23:00') then
        ShowMessage('c')
      else ShowMessage('d');
    end;
      

  6.   

    来一个我自认为好的办法吧
    if Time >= StrToTime('8:20:00') then ShowMessage('测试通过');
       ~~~~@1   ~~~~~~~~~@2@1取得当前时间,不知是否有此函数,
    @2把字符型转换成时间型,不知是否有此函数,因为,无论日期还是时间型,都可以转换成Int 或 Real等类型的//偶?!也配来回答问题?!函数都不知道
    //唉,没戏了,得不了分了,~~~~~~~~~5555555555