Create NSDate from day/month/year


I want to create an NSDate object using the values for day, month and year.


// Initialize Date components
var c = NSDateComponents()
c.year = 2015
c.month = 8 = 31

// Get NSDate given the above date components
var date = NSCalendar(identifier: NSCalendarIdentifierGregorian)?.dateFromComponents(c)


Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)