有一个整型数 130 要转换成 "2:10"也就将一个整数转成时间格式!

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
    a:integer;
    temp1,temp2:string;
    begin
      a:=strtoint(edit1.Text);
      temp1:=inttostr(a div 60);
      temp2:=inttostr(a mod 60);
      if temp2='0' then temp2:='00';
      label1.Caption:=temp1+':'+temp2;
    end;
    ////
      

  2.   

    select
    convert(char(8),
    cast(convert(char(8), dateadd(minute,130,getdate()),108) as datetime)-cast( convert(char(8),getdate(),108) as datetime)
    ,108)
      

  3.   

    上面的,在SQL SERVER中已测试:
    是Delphi社区,我还以为是SQL SERVER,俺用delphi试试
      

  4.   

    130是秒数你直接运算不就出来了么,
    130 div 60:=分
    130/60:=秒