How to check if two NSDates are from the same day
<p>I am working on ios development and I find it really hard to check if two NSDates are from the same day. I tried to use this</p>

<pre><code>   fetchDateList()
    // Check date
    let date = NSDate()
    // setup date formatter
    let dateFormatter = NSDateFormatter()
    // set current time zone
    dateFormatter.locale = NSLocale.currentLocale()

    let latestDate = dataList[dataList.count-1].valueForKey("representDate") as! NSDate
    //let newDate = dateFormatter.stringFromDate(date)
    let diffDateComponent = NSCalendar.currentCalendar().components([NSCalendarUnit.Year, NSCalendarUnit.Month, NSCalendarUnit.Day], fromDate: latestDate, toDate: date, options: NSCalendarOptions.init(rawValue: 0))
    print(diffDateComponent.day)
</code></pre>

<p>but it just checks if two NSDates has a difference of 24 hours. I think there is a way to make it work but still, I wish to have NSDate values before 2 am in the morning to be count as the day before, so I definitely need some help here. Thanks!</p>