In a swift playground, I have been using
NSDate.date()
But, this always appears with the time element appended. For my app I need to ignor
For Swift3
var order = NSCalendar.current.compare(firstDate, to: secondDate, toGranularity: .hour) if order == .orderedSame { //Both the dates are same. //Your Logic. }