title: Convert time string into date swift
body: <p>I am using firebase as a backend and storing a string of time like this 7:00 PM.</p>
  
  <p>I am trying to convert the string received from Firebase and convert it into NSDate so I can sort it, change the time..etc</p>
  
  <p>I've looked online and come up with this code so far</p>
  
  <pre><code>dateFormatter.dateFormat = "hh:mm a"
                    dateFormatter.locale = NSLocale.current
                    dateFormatter.timeZone = NSTimeZone.local
                    let date = dateFormatter.date(from: item)
                    self.times.append(date!)
                    print("Start: \(date)")
  </code></pre>
  
  <p>where item is the string (7:00 PM)</p>
  
  <p>When I run the app, the console returns: </p>
  
  <blockquote>
    <p>Item: 9:00 AM </p>
    
    <p>Start: Optional(2000-01-01 05:00:00 +0000)</p>
  </blockquote>
  
  <p>Ive set timezone, locale, format. Why is the time being returned not correct?</p>
  
  <p>A few other examples printed out:</p>
  
  <blockquote>
    <p>Item: 1:20 PM</p>
    
    <p>Start: Optional(2000-01-01 17:20:00 +0000)</p>
    
    <p>Item: 9:40 AM</p>
    
    <p>Start: Optional(2000-01-01 05:40:00 +0000)</p>
    
    <p>Item: 10:00 AM </p>
    
    <p>Start: Optional(2000-01-01 05:00:00 +0000) </p>
    
    <p>Item: 12:00 PM </p>
    
    <p>Start: Optional(2000-01-01 17:00:00 +0000)</p>
  </blockquote>