title: How to Convert date into local time zone ios swift
body: <p>I'm working on date formatter, I got a response of date from server in string type, which I convert into date format but what I want to do is to convert a date and then manage according to local time.</p>
  
  <p>For example, if <code>12/06/2017, 06:48:03</code> is a date from server and i'm from Pakistan so it gives me a date and time according to GMT+5 which is <code>12/06/2017, 11:48:03</code></p>
  
  <p>Same as from India it gives me a date and time according to GMT+5:30 which is <code>12/06/2017, 12:18:03</code></p>
  
  <p>Here is a source code</p>
  
  <pre><code>public class func converServerTimeStampToDate (_ timeStamp: String) -&gt; Date {
  
          let dateFormatter = DateFormatter()
          dateFormatter.dateFormat = "MM/dd/yyyy, hh:mm:ss a"
          dateFormatter.timeZone = TimeZone(abbreviation: "UTC")
          let localDate = dateFormatter.date(from: timeStamp)
          dateFormatter.timeZone = TimeZone.current
          dateFormatter.dateFormat = "MM/dd/yyyy, hh:mm:ss a"
  
         // return dateFormatter.string(from: localDate!)
          return dateFormatter.date(from:dateFormatter.string(from: 
         localDate!))!
  
      }
  </code></pre>
  
  <p>Any help would be appreciated !!</p>