首页  编辑  

给定秒转化成hh:mm:ss

Tags: /超级猛料/Date.Time.时间和日期/   Date Created:

把秒数转换成hh:mm:ss格式

function SecondToTime(a:integer):string;

begin

 result:=timetostr(a/86400);

end;

或者:

Format('%-.2d:%-.2d:%-.2d', [FTime div 3600, (FTime mod 3600) div 60,FTime mod 60]);

function ConvertSecondsToTime(iSeconds: Word): TDateTime;

var

 Hour, Min, Sec: Word;

begin

 Hour := iSeconds div 3600;

 Min := (iSeconds div 60) mod 60;

 Sec := iSeconds mod 60;

 Result := EncodeTime(Hour, Min, Sec, 0);

end;

function SecToDateTime(Sec: LongWord):Double;

begin

  Result:=(Sec/SecsPerDay);

end;