let formatter = DateFormatter()
formatter.dateFormat = "dd/MM/yyyy"
let firstDate = formatter.date(from: "8/08/2017")
let secondDate = formatter.date(from: "10/08/2017")
if firstDate?.compare(secondDate!) == .orderedAscending {
print("First Date is smaller then second date")
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter