Cocoa 中是否有一些功能可以用自然语言显示时间间隔? [英] Is there some functionality in Cocoa to display time intervals in natural language?
本文介绍了Cocoa 中是否有一些功能可以用自然语言显示时间间隔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找的是一个可以用自然语言显示时间间隔的 Cocoa(或第三方)类,例如:
What I am searching for is a Cocoa (or third party) class that can display time intervals in natural language, e.g.:
- 10 秒前
- 1 小时前
- 2 天前
你知道有什么可以帮助我完成这项任务而无需自己编写并陷入 if-else 地狱的吗?
Do you know anything that could help me to achieve this task without writing it by myself and melting in if-else hell?
推荐答案
我最初指出的那个似乎不存在了,但正如指出的那样有 NSDate-TimeAgo,我没试过,但我觉得不错.
The one I've originally pointed to does not seem to be there anymore but as pointed out there is NSDate-TimeAgo, I haven't tried it but looks good to me.
更新答案以指向现有代码
updated answer to point to existing code
这篇关于Cocoa 中是否有一些功能可以用自然语言显示时间间隔?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文