title: Convert NSDate to String in iOS Swift
body: <p>I am trying to convert a <code>NSDate</code> to a <code>String</code> and then Change Format. But when I pass <code>NSDate</code> to <code>String</code> it is producing whitespace.</p>
  
  <pre><code> let formatter = DateFormatter()
   let myString = (String(describing: date))
   formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
   let yourDate: Date? = formatter.date(from: myString)
   formatter.dateFormat = "dd-MMM-yyyy"
   print(yourDate)
  </code></pre>