Getting of year, month, day from NSDate in Swift

let now = NSDate()
let flags = NSCalendarUnit(rawValue: UInt.max)
let components = NSCalendar.currentCalendar().components(flags,
fromDate: now)

let year = components.year
let month = components.month
let day = components.day