Snippets Collections
func isDayEnded(recent: Date, previous: Date) -> Bool {
    let day:Int = Calendar.current.dateComponents([.day], from: previous, to: recent).day ?? 0
    if day >= 1 {
        return true
    } else {
        return false
    }
}
let previous = NSDate(timeIntervalSince1970: 1645601459)
let recent = NSDate(timeIntervalSince1970:   1648020659)
let dayEnded = isDayEnded(recent: recent as Date, previous: previous as Date)
print("Day = \(dayEnded)")
star

Thu Feb 24 2022 07:51:11 GMT+0000 (UTC)

#ios #swift #day #date #difference

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension