Display formatted date from DatePicker in iOS

If you have an NSDate object from a UIDatePicker and you want to display it formatted:

let dateFormatter = NSDateFormatter()
dateFormatter.dateStyle = NSDateFormatterStyle.MediumStyle
        
myDateLabel.text = dateFormatter.stringFromDate(myDatePicker.date)

 

Leave a Reply

Your email address will not be published. Required fields are marked *