如果当前时间是13:08:20
我想得到13:00:00的时间要怎么写

解决方案 »

  1.   

    formatdatetime('yyyy''年''M''月''d''日''H''点''mm''分''ss''秒''',now);
      

  2.   

    strtodatetime(formatdatetime('hh:00:00',now))
      

  3.   

    function TForm1.ReturnMyTime(mytime:TTime):TTime;
    begin
      try
        Result:=StrToTime(IntToStr(HourOf(myTime))+':00:00');
      except
        ShowMessage('制定的时间无效!');
      end;
    end;
    注意:在Uses 中添加DateUtils单元
      

  4.   

    formatdatetime是格式化输出日期和时间.
    label1.Caption:=formatdatetime('H:00:00',时间);
      

  5.   

    function TForm1.ReturnMyTime(mytime:TTime):TTime;
    begin
      try
        Result:=StrToTime(IntToStr(HourOf(myTime))+':00:00');
      except
        ShowMessage('指定的时间无效!');
        Result:=StrToTime('00:00:00');
      end;
    end;
    注意:在Uses 中添加DateUtils单元
      

  6.   

    你可以用  decodetime(now())  分解开,然后用encodetime 再组合起来。
      

  7.   

    StrToDateTime(FormatDateTime('YYYY-MM-DD HH'),now)+':00:00');
    就ok