title: Convert the Time to GMT and then upload the timestamp to Firebase (Swift)
body: <p><strong>What I want to do:</strong> Convert the current time of the user to a GMT timestamp and then upload it to firebase.</p>
  <p><strong>Problem:</strong> The timestamp in my Firestore database is not the GMT timestamp, but the regular one with the unique timezone of the user.</p>
  <p><strong>My code:</strong></p>
  <pre><code>let formatter = DateFormatter()
  formatter.timeZone = TimeZone(secondsFromGMT: 0)
  formatter.dateFormat = &quot;yyyy-MM-dd HH:mm:ss Z&quot;
  let date = Date()
  </code></pre>
  <pre><code>self.db.collection(&quot;posts&quot;).document(combined).setData([
      &quot;time&quot;: date,
  ]) { err in
      if let err = err {
          print(&quot;Error writing document: \(err)&quot;)
      } else {
          print(&quot;Post Document successfully written!&quot;)
          print(date)
      }
  }
  </code></pre>
  <p><strong>What actually happens so far:</strong>
  I get <code>2020-06-26 17:57:40 +0000</code>when I print out the date after I uploaded to firebase. This is the timestamp I want to upload.</p>
  <p>But once I check firebase I see:
  <a href="https://i.stack.imgur.com/WOYl8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WOYl8.png" alt="enter image description here" /></a></p>
  <p><strong>What I tried:</strong></p>
  <ul>
  <li>Deleting the app and installing it once again</li>
  <li>Clearing my firebase Firestore</li>
  </ul>