如何得到现在时间加5分钟以后的时间?
label1.caption:=timetostr(now);
我想让
lable2.caption:=现在时间加5分钟之后的时间?

解决方案 »

  1.   

    dd,mm,ss,mesc :word;
    tt:real;
    decodetime(time,dd,mm,ss,mesc);
    tt:=mm+5;  
    if tt>=60 then
    begin
      mm:=tt-60;
      inc(dd);
    end;
    encodetime(dd,mm,ss,mesc);
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var d: tdatetime;
    begin
      d:=now+strtodatetime('00:05:00');
      showmessage(datetimetostr(d));
    end;
      

  3.   

    同意:
        erice
      

  4.   

    function IncMinute(const AValue: TDateTime; const ANumberOfMinutes: Int64 = 1): TDateTime;直接调用它就行了
      

  5.   

    erice的不对吧,我调试了, fjyhs的可以,但天了,月了,年了,就不行了
      

  6.   

    label1.Caption := TimeToStr(Now + 5.0 / 1440);   // 现在时间加5分钟之后的时间
      

  7.   

    同意kyee(浪子阿鹏) 
    var  
      a: TDateTime;
      b: string;
      c: double;   //需要相加的分钟数,5分钟
    begin
      ...
      a := ...       //赋值,时间
      b := DateTimeToStr(a + c/1440);
      ...
    end;
      

  8.   

    var
      nowdatetime,lastdatetiem:datetime;
    begin
      nowdatetime:=now;
      lastdatetime:=nowdatetime+5*1/24;
    end