We convert the specified number of seconds into days, hours, minutes and seconds.
1 2 3 4 5 6 7 8 |
var sec: Integer; dhms: string; begin sec:= 2145414543; dhms:= secToDHMS(sec); ShowMessage(dhms); end; |
Options
sec - seconds
Result
A string in the format: x days x hours x minutes x seconds.
1 2 3 4 5 6 7 8 9 10 11 |
function secToDHMS(sec: Integer): string; var D, H, M, S, ATime: Integer; begin D:= sec div 86400; H:= (sec - D * 86400) div 60 div 60; M:= (sec - D * 86400 - H * 3600) div 60; S:= sec - D * 86400 - H * 3600 - M * 60; Result := Format('%d days %d hours %d minutes %d seconds', [D, H, M, S]); end; |