如何将毫秒如"4564864612879"转换成这样的(时/分/秒/毫秒)格式如"00:00:00:000"? 知道的高手希望能够出来讲讲.谢了.
解决方案 »
- delphi和c#哪个开发应用程序更强?
- debug windows 可以自动列出物件的各种属性吗
- 统计listbox1增加了的记录
- 请教!!寻找详细介绍wordapplication等控件的方法和属性的地方!!
- 恐怕又是个没有人回答的问题,有谁对DevExpress中的TdxTreeList进行过继承?
- 怎样判断一个数据库(ACCESS)里的某一个数据表是否存在?急!!
- 关于集合用来判断字符类型的问题
- 这样的界面是在什么编程语言环境下实现的?急!急!!急!!!
- 请各位仁兄帮忙指教!!
- 如何实现dbgrid显示时的各列宽度自适应调整?
- 怎样解决DLL中函数返回一个字符串时产生的'Invalid pointer operation'错误?
- 在form之间传递变量值?
up
Formattime('yyyy"时"mm"分"dd"秒"hh"毫秒"',4564845456436 / 1000 / 60 / 60 / 24);
可以吗?
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;
inttostr(4564864612879 div 24*60*60*1000)+
inttostr(4564864612879 mod 24*60*1000)+
inttostr(4564864612879 mod 24*1000)+
inttostr(4564864612879 mod 1000)
inttostr(4564864612879 mod 24*60*1000)+
inttostr(4564864612879 mod 24*1000)+
inttostr(4564864612879 mod 1000)
inttostr((((4564864612879 mod 24)mod 60)mod 60)mod 1000)
+
.....
关键就是把你的毫秒数换成天数。小数部分就是表示时间的Tdatetime值。 x:=24*60*60*1000;
edit1.text:=formatdatetime('hh:nn:ss:zzz',4564864612879/x);
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;