Exemplo: se a função receber o valor 61, ela vai retornar o valor 00:01:01
function FormatSecsToHMS(Secs: LongInt): string;
var
Hrs, Min: Word;
horas, minutos, segundos: string;
begin
Hrs := Secs div 3600;
Secs := Secs mod 3600;
Min := Secs div 60;
Secs := Secs mod 60;
if Hrs = 0 then
horas := '00'
else
horas := IntToStr(Hrs);
if Min = 0 then
minutos := '00'
else
if(Min < 10) then
minutos := '0' + IntToStr(Min)
else
minutos := IntToStr(Min);
if Secs = 0 then
segundos := '00'
else
if(Secs < 10) then
segundos := '0' + IntToStr(Secs)
else
segundos := IntToStr(Secs);
Result := horas + ':' + minutos + ':' + segundos;
end;
Nenhum comentário:
Postar um comentário