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 comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.