title: Swift how to convert string to NSDate
body: <p>I've got a <code>date</code> stored in my database and I want to retrieve it and display it nicely in my tableview cells.</p>
  
  <p>The format it comes in from the database and stored in option1 is <code>BO05151530</code></p>
  
  <p>Where the first two letters have meaning in the program but are not needed for the date so I take those off using the <code>substringFromIndex</code> function.</p>
  
  <p>So what is left is <code>05151530</code>  where it represents <code>MMddhmm</code></p>
  
  <p>I would like to display it nicely like <code>MM-dd @ h:mm a</code></p>
  
  <p>For example <code>12-05 @ 3:45 am</code></p>
  
  <p>Here is what I tried but unfortunately <code>ns_date1</code> comes up as nil each time.</p>
  
  <p>What would you suggest I do?</p>
  
  <pre><code>let date1 = option1.substringFromIndex(option1.startIndex.advancedBy(2))
  
  let dateFormatter = NSDateFormatter()
  dateFormatter.dateFormat = "MMddhhmm"
  
  let ns_date1 = dateFormatter.dateFromString(date1)
  </code></pre>