title: Xcode Entity Core Data - NSDate wrong year?
body: <p>When storing values to core data, the Date is stored as a TimeStamp but the year is incorrect. How can I sore the correct datetime to core storage?</p>
  
  <h2>Steps taken</h2>
  
  <p>Using Xcode and Swift I have created an iPhone project and added an Entity with the following attributes:</p>
  
  <pre><code>Attribute    Type
  -------------------
  name         String
  date         Date
  </code></pre>
  
  <p>I am using core data to save data entries. eg:</p>
  
  <pre><code> myEntity = MyEntity(context: self.viewContext)  
   myEntity.name = nameString
   myEntity.date = Date() as NSDate
   self.appDelegate.saveContext()
  </code></pre>
  
  <p>This creates records on the phone in a sqlite database. When I open the Sqlite database on the phone, I can see the records created as follows:</p>
  
  <pre><code>Z_PK    Z_NAME    Z_DATE
  1       George    521035200
  </code></pre>
  
  <p>Converting the Date value using the following command:</p>
  
  <pre><code>SELECT datetime(521035200, 'unixepoch');
  
  OUTPUTS: 1986-07-06 12:00:00
  </code></pre>
  
  <p>The day/month is correct but the year should be 2017.</p>
  
  <p>What is the correct format of the timestamp in SQLite?</p>
  
  <p>Is it possible to store a date using Xcode Entity instead of a time stamp?</p>