title: DateTime2 formart conversion to Swift Date
body: <p>I have a date string coming from back-end as &quot;2022-08-16T13:44:11.8743234&quot;. Date formatting and conversion is the oldest skill in the book but I cannot figure out why I'm unable to convert that string to a Date object in Swift iOS. I just get nil with any source format I specify.</p>
  <pre><code>private func StringToDate(dateString: String) -&gt; Date?
  {
      let formatter = DateFormatter()
      formatter.dateFormat = &quot;YYYY-MM-DDTHH:mm:ss.[nnnnnnn]&quot;
      let date = formatter.date(from: dateString)
      return date //this is nil every time
  }
  </code></pre>
  <p>DateTime2 is a more precise SQL Server extension of the normal C# DateTime, hence why the date string has 7 decimal places afters the seconds.</p>
  <p>What am I doing wrong?</p>