title: Get UTC time for a particular date and time in swift?
body: <p>Helllo all,</p>
  
  <p>I have a particular date &amp; time selected from datepicker in iOS. i want to convert this date &amp; time into UTC time.I have used below function for it.</p>
  
  <pre><code>func get_Date_time_from_UTC_time(string : String) -&gt; String {
  
      let dateformattor = DateFormatter()
      dateformattor.dateFormat = "yyyy-MM-dd HH:mm:ss"
      dateformattor.timeZone = NSTimeZone.init(abbreviation: "UTC") as TimeZone!
      let dt = string
      let dt1 = dateformattor.date(from: dt as String)
      dateformattor.dateFormat = "yyyy-MM-dd HH:mm:ss ZZZ"
      dateformattor.timeZone = NSTimeZone.local
      return dateformattor.string(from: dt1!)
    }
  </code></pre>
  
  <p>My location is in india. So when i pass time like <code>2016-12-26 09:53:45</code> then it gives me UTC time as <code>2016-12-26 15:23:00 +0530</code>.Now when i search in google for UTC time it shows me time as <code>4:32 AM 26 december</code>.Please tell why is such diffrence &amp; am i doing correct ?</p>