如何将毫秒如"4564864612879"转换成这样的(时/分/秒/毫秒)格式如"00:00:00:000"?  知道的高手希望能够出来讲讲.谢了.

解决方案 »

  1.   

    Formattime('yyyy"时"mm"分"dd"秒"hh"毫秒"',4564845456436);
      

  2.   

    Formattime('yyyy"时"mm"分"dd"秒"hh"毫秒"',4564845456436);
    up
      

  3.   

    Formattime('yyyy"时"mm"分"dd"秒"hh"毫秒"',4564845456436);测试不能通过
      

  4.   

    如果该成
    Formattime('yyyy"时"mm"分"dd"秒"hh"毫秒"',4564845456436 / 1000 / 60 / 60 / 24);
    可以吗?
      

  5.   

    FormatDateTime('yyyy-mm-dd-hh',Now);可以吗?
      

  6.   

    formatdatetime('hh:nn:ss:zzz',4564864612879);
      

  7.   

    错了可以这样:
    procedure TForm1.Button1Click(Sender: TObject);
    var x:double;
    begin
      x:=24*60*60;
      x:=x*1000000;
      edit1.text:=formatdatetime('hh:nn:ss:zzz',4564864612879/x);
    end;
      

  8.   

    to tweety(@@):   你的方法还是不能够显示最后的毫秒部分啊。
      

  9.   


    inttostr(4564864612879 div 24*60*60*1000)+
    inttostr(4564864612879 mod 24*60*1000)+
    inttostr(4564864612879 mod 24*1000)+
    inttostr(4564864612879 mod 1000)
      

  10.   

    inttostr(4564864612879 mod 24*60*60*1000)+
    inttostr(4564864612879 mod 24*60*1000)+
    inttostr(4564864612879 mod 24*1000)+
    inttostr(4564864612879 mod 1000)
      

  11.   

    上面的错了,呵呵,不知这个对不对
    inttostr((((4564864612879 mod 24)mod 60)mod 60)mod 1000)
    +
    .....
      

  12.   

    不可能,我测试过了,你可以再看看formatdatetime和Tdatetime的帮助。
    关键就是把你的毫秒数换成天数。小数部分就是表示时间的Tdatetime值。  x:=24*60*60*1000;
      edit1.text:=formatdatetime('hh:nn:ss:zzz',4564864612879/x);
      

  13.   

    写一个函数吧,这种问题可以引申到其他地方。procedure TForm1.Button1Click(Sender: TObject);
    var
      iInput: Integer;
      iHH, iMM, iSS, iNN: Integer;//定义小时数,分钟数,秒数,毫秒数;
      sOut: string;
    begin
      iInput := StrToInt(Edit1.Text);  iHH := iInput div (1000*60*60);
      iMM := (iInput - iHH*(1000*60*60)) div (1000*60);
      iSS := (iInput - iHH*(1000*60*60) - iMM*(1000*60)) div 1000;
      iNN := iInput - IHH*(1000*60*60) - iMM*(1000*60) - iSS*1000;  sOut := IntToStr(iHH) +':'+ IntToStr(iMM) +':'+ IntToStr(iSS) +':'+ IntToStr(iNN);  Edit2.Text := sOut;
    end;