title: Swift date format returning wrong date
body: <p>I need to convert my <strong>date</strong> to <strong>string</strong> and then <strong>string</strong> to <strong>date</strong>. date is &quot;<strong>2020-10-17 1:22:01 PM +0000</strong>&quot;</p>
  <p><strong>Here is my date to string conversion code:</strong></p>
  <pre><code>                    let formatter = DateFormatter()
                      formatter.locale = Locale(identifier: &quot;en_US_POSIX&quot;)
                      formatter.dateFormat = &quot;yyyy-MM-dd'T'HH:mm:ssXXXXX&quot;
                       let string = formatter.string(from: &quot;2020-10-17 1:22:01 PM +0000&quot;)
                      let createdAT = string
  </code></pre>
  <p>its returning <strong>&quot;2020-10-17 18:51:30+05:30&quot;</strong></p>
  <p><strong>Here is my string to date conversion code:</strong></p>
  <pre><code>     let dateFormatter = DateFormatter()
       dateFormatter.locale = Locale(identifier: &quot;en_US_POSIX&quot;)
       dateFormatter.dateFormat = &quot;yyyy-MM-dd' 'HH:mm:ssZ&quot;
       let date = dateFormatter.date(from:date)!
  </code></pre>
  <p>its returning <strong>&quot;2020-10-17 1:21:30 PM +0000 - timeIntervalSinceReferenceDate : 624633690.0&quot;</strong></p>
  <p>its returning the wrong date after i convert string to date. i need <strong>&quot;2020-10-17 18:51:30+05:30&quot;</strong> this time to be return when i convert string to date.....</p>