title: How does Swift manage dates in CoreData
body: <p>I have been including a date in my CoreData, and was curious too see what happens behind the scenes with the underlying SQLite database.</p>
  <p>I noticed that while <code>integer</code> and <code>varchar</code> are are used for other CoreData attributes, a CoreData <code>Date</code> attribute appears in SQLite as <code>timestamp</code>.</p>
  <p>Now I know that SQLite has its quirks, notably:</p>
  <ul>
  <li>Columns have a type affinity rather than a fixed type, so you can put whatever you like wherever you like</li>
  <li>You can make up your own column types</li>
  <li>There is no distinct date/time type, and that SQLite has conversion functions to work with string, integer or real representations of the date/time</li>
  </ul>
  <p>I also notice that the date is stored in a human-readable format. However, it appears to be a non-standard format which is also off by a few years.</p>
  <p>For example:</p>
  <ul>
  <li>The SQLite version is <code>1989/10/05 13:15:45</code></li>
  <li>The IS8601 formatted version is <code>2020-10-05T14:15:45+11:00</code></li>
  </ul>
  <p>The ISO8601 exported version above is correct. The SQLite version above is off by 31 years, ignores our DST offset, and doesn’t conform to any standards that I’m aware of.</p>
  <p>How does CoreData mange its dates?</p>