I currently am saving dates in my iOS application in CoreData. In Core Data, my date attribute is of type "Date". In my NSManagedObjectSubclass file, the attribute is of type: NSDate (which is fine). The date in Core Data is being stored as: 2014/05/16 14:54:51 and when I check the actual values in my SQLite3 navigator, it is being stored in the form:
421959291.293972 for the date
How do I get the above value for the date, and is there a way to convert it back to the form: 2014/05/16 14:54:51? I'm asking this because I am trying to create a dataset via a CSV file, and want to make sure that all the values that I enter in the CSV file are converted correctly by Core Data/SQLite3 into the right format.
if you are using sqlite3 as the command line tool, use the the datetime function to interpret the data, so for example
This should give the formatted timestamp stored in the entity table
The unix epoch/31 years arguments come from this stack overflow question. Behind The Scenes: Core Data dates stored with 31 year offset?