UIDatePicker returns me the date in the form of 15Aug,2016 but my date format should be 15/08/2016 in string format. Example "dob" = "15/08/2016" I am using this code
let dateFormatter=NSDateFormatter()
dateFormatter.dateFormat="dd-MM-yyyy"
let strDate=dateFormatter.stringFromDate(myDatePicker.date) as String
dict["dob"] = strDate
But I am not getting proper string .
you can use this
let dateformatter = NSDateFormatter()
dateformatter.dateStyle = NSDateFormatterStyle.ShortStyle
let dob = dateformatter.stringFromDate(NSDate())
the dob in 15/08/2016 format