Get Date And check Compare Yesterday Ios/Iphone


let yesterday = today.dateByAddingTimeInterval(-86400.0)
let thisWeek = today.dateByAddingTimeInterval(-604800.0)
let lastWeek = today.dateByAddingTimeInterval(-1209600.0)

let thisMonth = today.dateByAddingTimeInterval(-2629743.83)
let lastMonth = today.dateByAddingTimeInterval(-5259487.66)
 
 
 
let calendar = NSCalendar(identifier: NSCalendarIdentifierGregorian)
 let components = calendar.components([.Year, .Month, .Day], fromDate: today)
 let (year, month, day) = (components.year, components.month, components.day) 

Popular posts from this blog

How to Use pagination ScrollView in Swift

UISearchBar search text color , background color swift 3

How To Add Multiple Line in Lable in Swift Ios