将 NSTimeInterval 转换为国际通用的字符串的正确方法是什么?

发布于 2024-08-25 05:16:25 字数 99 浏览 3 评论 0原文

我知道除以 60 得到分钟、小时等的快速而肮脏的方法,

但是 API 中是否有已经实现的官方方法,并使用适当的语言来表示分钟、秒等?

感谢您的任何帮助。

I know the quick and dirty way of dividing by 60 to get minute, hours, etc

But is there an official way in the API already implemented, and using the appropriate language for minutes, seconds, etc?

Thanks for any help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一人独醉 2024-09-01 05:16:26

使用 NSDate 的 -dateWithTimeInterval... 方法之一根据您的时间间隔创建日期,然后将其传递给 NSDateFormatter,该 NSDateFormatter 配置为显示所需格式的日期。

Use one of NSDate's -dateWithTimeInterval... methods to create a date from your interval, then hand it to an NSDateFormatter that is configured to display the date formatted as desired.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文