谁能帮我如何将delphi中的int变量格式化为分钟:秒?
样本: myVar := 19;
我的标签标题应显示 00:19
有人知道吗?谢谢
最佳答案
这将避免秒值溢出到小时中的任何错误。
var
secs: integer;
str: string;
begin
secs := 236;
// SecsPerDay comes from the SysUtils unit.
str := FormatDateTime('nn:ss', secs / SecsPerDay));
// If you need hours, too, just add "hh:" to the formatting string
secs := 32236;
str := FormatDateTime('hh:nn:ss', secs / SecsPerDay));
end;
关于delphi - 将 int 变量格式化为 mm :ss,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9175021/