title: How to post data to Firestore as Timestamp data type - swift
body: <p>I wonder how can I post data as <code>String</code> to <code>Firestore</code> as <code>Timestamp</code>. I am creating a sample app which store data on <code>tableView</code> and data are going to sort base on <code>Timestamp</code>. </p>
  
  <p>So, in programming I have tried to get current time and date as <code>String</code> but I don't know how to set data to <code>Firestore</code> as field is <code>Timestamp</code>. When i query data from <code>Firestore</code> i want to sort data base on <code>Timestamp</code>.</p>
  
  <pre><code>let currentDateTime = Date()
  
  // initialize the date formatter and set the style
  let formatter = DateFormatter()
  formatter.timeStyle = .long
  formatter.dateStyle = .long
  
  // get the date time String from the date object
  formatter.string(from: currentDateTime)
  </code></pre>
  
  <p><code>Timestamp</code> in <code>Firestore</code> contain date and time.
  How can I post data as <code>String</code> to <code>Firestore</code> as <code>Timestamp</code>?</p>