了解NSDate是今天,昨天,明天 [英] Find out if an NSDate is today, yesterday, tomorrow
本文介绍了了解NSDate是今天,昨天,明天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用iOS SDK,我需要找到一种简单安全的方法来查看NSDate今天,昨天,明天。我正在寻找的是伪代码中的这样的东西:
With the iOS SDK I need to find an easy and secure way to see if an NSDate is today, yesterday, tomorrow. What I'm looking for is something like this in pseudo code:
NSDate *myDate = someDate;
if ([myDate isTomorrow]) {
NSLog("Tomorrow");
}
你会如何解决它?
推荐答案
检查我们的Erica Sadun的优秀 NSDate
扩展
类: http://github.com/erica/NSDate-Extensions
Check our Erica Sadun's great NSDate
extension
class: http://github.com/erica/NSDate-Extensions
有很多日期比较,其中正是你需要的:)
There are lots of date comparisons, among them exactly what you need :)
这篇关于了解NSDate是今天,昨天,明天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文