remove time from a date like this 2016-02-10 00:00:00
<p>hello I have a date like this </p>

<pre><code>2016-02-10 00:00:00
</code></pre>

<p>I want to get only date from it in this style</p>

<pre><code>14.05.2016 or 14-05-2016
</code></pre>

<p>This is what I have tried</p>

<pre><code>let dateFormatter = NSDateFormatter()
let date = "2016-02-10 00:00:00"
dateFormatter.dateFormat = "dd-MM-yyyy"
let newdate = dateFormatter.dateFromString(date)
print(newdate) //nil is coming
</code></pre>